Diff for /loncom/interface/loncreatecourse.pm between versions 1.40 and 1.44

version 1.40, 2003/12/05 15:57:37 version 1.44, 2003/12/11 02:42:38
Line 48  use Apache::loncommon; Line 48  use Apache::loncommon;
 use Apache::lonratedt;  use Apache::lonratedt;
 use Apache::londocs;  use Apache::londocs;
 use Apache::lonlocal;  use Apache::lonlocal;
   use Apache::londropadd;
   use lib '/home/httpd/lib/perl';
   use localenroll;
   
 # ================================================ Get course directory listing  # ================================================ Get course directory listing
   
Line 243  sub print_course_creation_page { Line 246  sub print_course_creation_page {
      &Apache::loncommon::selectcourse_link       &Apache::loncommon::selectcourse_link
      ('ccrs','clonecourse','clonedomain');       ('ccrs','clonecourse','clonedomain');
     my $coursebrowserjs=&Apache::loncommon::coursebrowser_javascript();      my $coursebrowserjs=&Apache::loncommon::coursebrowser_javascript();
     my $date_table = &date_setting_table();      my $starttime = time;
       my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
       my $date_table = &Apache::londropadd::date_setting_table($starttime,$endtime,'createcourse');
     my ($krbdef,$krbdefdom) =      my ($krbdef,$krbdefdom) =
     &Apache::loncommon::get_kerberos_defaults($defdom);      &Apache::loncommon::get_kerberos_defaults($defdom);
     my $javascript_validations=&javascript_validations($krbdefdom);      my $javascript_validations=&Apache::londropadd::javascript_validations('createcourse',$krbdefdom);
     my %param = ( formname => 'document.ccrs',      my %param = ( formname => 'document.ccrs',
                    kerb_def_dom => $krbdefdom,                     kerb_def_dom => $krbdefdom,
                    kerb_def_auth => $krbdef                     kerb_def_auth => $krbdef
Line 274  function openbrowser(formname,elementnam Line 279  function openbrowser(formname,elementnam
     editbrowser = open(url,title,options,'1');      editbrowser = open(url,title,options,'1');
     editbrowser.focus();      editbrowser.focus();
 }  }
   $javascript_validations
 </script>  </script>
 $coursebrowserjs  $coursebrowserjs
 <head>  <head>
Line 378  on information available for this specif Line 384  on information available for this specif
 </p>  </p>
 <p>  <p>
 <b>Automated adds</b>  <b>Automated adds</b>
 <input type="radio" name="autoadds" value="1" checked="true" />Yes <input type="radio" name="autoadds" value="0" />No  <input type="radio" name="autoadds" value="1" />Yes <input type="radio" name="autoadds" value="0" checked="true" />No
 </p><p>  </p><p>
 <b>Automated drops</b>  <b>Automated drops</b>
 <input type="radio" name="autodrops" value="1" checked="true" />Yes <input type="radio" name="autodrops" value="0" />No  <input type="radio" name="autodrops" value="1" />Yes <input type="radio" name="autodrops" value="0" checked="true" />No
 </p><p>  </p><p>
 <b>Duration of automated classlist updates</b>  <b>Duration of automated classlist updates</b>
 $date_table  $date_table
Line 398  $locform Line 404  $locform
 <b>Notification of enrollment changes</b><br />  <b>Notification of enrollment changes</b><br />
 Notification to course coordinator via LON-CAPA message when enrollment changes occur during the automated update?<br/>  Notification to course coordinator via LON-CAPA message when enrollment changes occur during the automated update?<br/>
 <input type="radio" name="notify" value="1" />Yes <input type="radio" name="notify"  <input type="radio" name="notify" value="1" />Yes <input type="radio" name="notify"
 value="0" />No  value="0" checked="true" />No
 </p><p>  </p><p>
 <b>Include retrieval of student photographs?</b> <input type="radio" name="showphotos" value="1" />Yes <input type="radio" name="showphotos" value="0" checked="true" />No  <b>Include retrieval of student photographs?</b> <input type="radio" name="showphotos" value="1" />Yes <input type="radio" name="showphotos" value="0" checked="true" />No
 </p><p>  </p><p>
 <input type="hidden" name="phase" value="two" />  <input type="hidden" name="phase" value="two" />
 <input type="submit" value="Open Course">  <input type="button" onClick="verify_message(this.form)" value="Open Course">
 </p>  </p>
 </form>  </form>
 </body>  </body>
Line 411  value="0" />No Line 417  value="0" />No
 ENDDOCUMENT  ENDDOCUMENT
 }  }
   
 sub javascript_validations {  
     my ($krbdefdom)=@_;  
     my %param = ( formname => 'ccrs',  
                   kerb_def_dom => $krbdefdom );  
     my $authheader = &Apache::loncommon::authform_header(%param);  
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();  
     return (<<ENDPICK);  
 function verify_message (vf,foundpwd) {  
     var foundatype=0;  
     var message='';  
     // alert('current.radiovalue = '+current.radiovalue);  
     if (current.radiovalue == null || current.radiovalue == 'nochange') {  
         // They did not check any of the login radiobuttons.  
         alert('You must choose an authentication type');  
         return;  
     }  
     foundatype=1;  
     if (current.argfield == null || current.argfield == '') {  
         var alertmsg = '';  
         switch (current.value) {  
             case 'krb':  
                 alertmsg = 'You need to specify the Kerberos domain';  
                 break;  
             case 'loc':  
             case 'fsys':  
                 alertmsg = 'You need to specify the initial password';  
                 break;  
             case 'fsys':  
                 alertmsg = '';  
                 break;  
             default:  
                 alertmsg = '';  
         }  
         if (alertmsg != '') {  
             alert(alertmsg);  
             return;  
         }  
     }  
     vf.submit();  
 }  
 $authheader  
 ENDPICK  
 }  
   
 sub date_setting_table {  
     my $starttime = time;  
     my $endtime = time+(6*30*24*60*60); # 6 months from now, approx  
     my $startform = &Apache::lonhtmlcommon::date_setter('ccrs','startdate',$starttime);  
     my $endform =  &Apache::lonhtmlcommon::date_setter('ccrs','enddate',$endtime);  
     my $perpetual = '<nobr><input type="checkbox" name="no_end_date"/> no ending date</nobr>';  
     my $result = '';  
     $result .= "<table>\n";  
     $result .= '<tr><td align="right">Starting Date</td>'.  
         '<td>'.$startform.'</td>'.  
         '<td></td>'."</tr>\n";  
     $result .= '<tr><td align="right">Ending Date</td>'.  
         '<td>'.$endform.'</td>'.  
         '<td>'.$perpetual.'</td>'."</tr>\n";  
     $result .= "</table>\n";  
     return $result;  
 }  
   
 # ====================================================== Phase two: make course  # ====================================================== Phase two: make course
   
 sub create_course {  sub create_course {
Line 556  ENDENHEAD Line 500  ENDENHEAD
 #  #
 # Set environment (will override cloned, if existing)  # Set environment (will override cloned, if existing)
 #  #
       my @affiliates = ();  # Used to accumulate sections and crosslistings
     if ($ENV{'form.crsid'}) {      if ($ENV{'form.crsid'}) {
         $cenv{'courseid'}=$ENV{'form.crsid'};          $cenv{'courseid'}=$ENV{'form.crsid'};
     }      }
Line 564  ENDENHEAD Line 509  ENDENHEAD
     }      }
     if ($ENV{'form.crssections'}) {      if ($ENV{'form.crssections'}) {
         $cenv{'internal.sectionnums'}=$ENV{'form.crssections'};          $cenv{'internal.sectionnums'}=$ENV{'form.crssections'};
           my @sections = ();
           if ($cenv{'internal.sectionnums'} =~ m/,/) {
               @sections = split/,/,$cenv{'internal.sectionnums'};
           } else {
               $sections[0] = $cenv{'internal.sectionnums'};
           }
           if (@sections > 0) {
               foreach (@sections) {
                   my ($sec,$gp) = split/:/,$_; 
                   push @affiliates,$ENV{'form.crscode'}.$sec;
               }
           }
     }      }
     if ($ENV{'form.crsxlist'}) {      if ($ENV{'form.crsxlist'}) {
         $cenv{'internal.crosslistings'}=$ENV{'form.crsxlist'};         $cenv{'internal.crosslistings'}=$ENV{'form.crsxlist'};
          my @xlists = ();
           if ($cenv{'internal.crosslistings'} =~ m/,/) {
               @xlists = split/,/,$cenv{'internal.crosslistings'};
           } else {
               $xlists[0] = $cenv{'internal.crosslistings'};
           }
           if (@xlists > 0) {
               foreach (@xlists) {
                   my ($xl,$gp) = split/:/,$_;
                   push @affiliates,$xl;
               }
           }
     }      }
     if ($ENV{'form.autoadds'}) {      if ($ENV{'form.autoadds'}) {
         $cenv{'internal.autoadds'}=$ENV{'form.autoadds'};          $cenv{'internal.autoadds'}=$ENV{'form.autoadds'};
Line 581  ENDENHEAD Line 550  ENDENHEAD
     }      }
     if ($ccuname) {      if ($ccuname) {
         $cenv{'internal.courseowner'} = $ccuname;          $cenv{'internal.courseowner'} = $ccuname;
       } else {
           $cenv{'internal.courseowner'} = $ENV{'user.name'};
       }
       if (@affiliates > 0) {
           my @badclasses = ();
           foreach my $class (@affiliates) {
               my $addcheck =  &localenroll::new_course($class,$cenv{'internal.courseowner'});
               unless ($addcheck eq 'ok') {
                   print STDERR "$class - $cenv{'internal.courseowner'} - $addcheck\n"; 
                   push @badclasses, $class; 
               }
           }
           if (@badclasses > 0) {
               $r->print('<font color="red">'.
                         "The courses listed below were included as sections or crosslistings affiliated with your new LON-CAPA course. If automated course roster updates are enabled for this class, these particular sections/crosslistings will not contribute towards enrollment, because the user identified as the course owner for this LON-CAPA course ($cenv{'internal.courseowner'}) - does not have rights to access enrollment in these classes (as determined by your instititution's policies on access to official classlists).<br/><ul>\n");
               foreach (@badclasses) {
                   $r->print("<li>$_</li>\n");
               }
               $r->print ("</ul><br/><br/></font>\n");
           }
     }      }
     my $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate');      my $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate');
     my $enddate   = &Apache::lonhtmlcommon::get_date_from_form('enddate');      my $enddate   = &Apache::lonhtmlcommon::get_date_from_form('enddate');

Removed from v.1.40  
changed lines
  Added in v.1.44


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