Diff for /loncom/interface/lonmodifycourse.pm between versions 1.32 and 1.35

version 1.32, 2007/09/24 23:29:53 version 1.35, 2007/12/05 02:55:40
Line 368  all settings except course code, course Line 368  all settings except course code, course
     }      }
     unless ($curr_authtype eq '') {      unless ($curr_authtype eq '') {
         $curr_authfield = $curr_authtype.'arg';          $curr_authfield = $curr_authtype.'arg';
     }       }
     my $javascript_validations=&Apache::londropadd::javascript_validations('modifycourse',$krbdefdom,$curr_authtype,$curr_authfield);      my $javascript_validations=&Apache::londropadd::javascript_validations('modifycourse',$krbdefdom,$curr_authtype,$curr_authfield);
     my %param = ( formname => 'document.cmod',      my %param = ( formname => 'document.'.$env{'form.phase'},
    kerb_def_dom => $krbdefdom,     kerb_def_dom => $krbdefdom,
    kerb_def_auth => $krbdef,     kerb_def_auth => $krbdef,
            mode => 'modifycourse',             mode => 'modifycourse',
Line 437  all settings except course code, course Line 437  all settings except course code, course
     my $mainheader = &mt('Course settings modifiable by [_1] only.',$dctitle);      my $mainheader = &mt('Course settings modifiable by [_1] only.',$dctitle);
     my $hidden_elements = &hidden_form_elements();      my $hidden_elements = &hidden_form_elements();
     $r->print(<<ENDDOCUMENT);      $r->print(<<ENDDOCUMENT);
 <form action="/adm/modifycourse" method="post" name="setparms">  <form action="/adm/modifycourse" method="post" name="$env{'form.phase'}">
 <h3>$mainheader</h3>  <h3>$mainheader</h3>
 </p><p>  </p><p>
 <table width="100%" cellspacing="6" cellpadding="6">  <table width="100%" cellspacing="6" cellpadding="6">
Line 561  sub modify_course { Line 561  sub modify_course {
     }      }
     if ($changeowner == 1 || $changecode == 1) {      if ($changeowner == 1 || $changecode == 1) {
         my $courseid_entry = &escape($cdom.'_'.$cnum).'='.&escape($description).':'.&escape($env{'form.coursecode'}).':'.&escape($env{'form.courseowner'}).':'.&escape($type);          my $courseid_entry = &escape($cdom.'_'.$cnum).'='.&escape($description).':'.&escape($env{'form.coursecode'}).':'.&escape($env{'form.courseowner'}).':'.&escape($type);
         &Apache::lonnet::courseidput($cdom,$courseid_entry,&Apache::lonnet::homeserver($cnum,$cdom));          my %courseid_entry = (
                $cdom.'_'.$cnum => {
                                   description => $description,
                                   inst_code   => $env{'form.coursecode'},
                                   owner       => $env{'form.courseowner'},
                                   type        => $type,
                                  },
           );
           &Apache::lonnet::courseidput($cdom,\%courseid_entry,
                                        &Apache::lonnet::homeserver($cnum,$cdom),'notime');
     }      }
   
     foreach my $param (@modifiable_params) {      foreach my $param (@modifiable_params) {
         if ($currattr{$param} eq $newattr{$param}) {          if ($currattr{$param} eq $newattr{$param}) {
             push(@nochanges,$param);              push(@nochanges,$param);
Line 573  sub modify_course { Line 581  sub modify_course {
             push(@changes,$param);              push(@changes,$param);
         }          }
     }      }
   
     if (@changes > 0) {      if (@changes > 0) {
         $chgresponse = &mt("The following automated enrollment parameters have been changed:<br/><ul>");          $chgresponse = &mt("The following automated enrollment parameters have been changed:<br/><ul>");
     }      }
     if (@nochanges > 0) {       if (@nochanges > 0) { 
         $nochgresponse = &mt("The following automated enrollment parameters remain unchanged:<br/><ul>");          $nochgresponse = &mt("The following automated enrollment parameters remain unchanged:<br/><ul>");
     }      }
     if (@changes > 0) {       if (@changes > 0) {
         my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,$cnum);          my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,$cnum);
         if ($putreply !~ /^ok$/) {          if ($putreply !~ /^ok$/) {
             $response = &mt("There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>");              $response = &mt("There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>").&mt('Error: ').$putreply;
         } else {          } else {
             foreach my $attr (@modifiable_params) {              foreach my $attr (@modifiable_params) {
                 if (grep/^$attr$/,@changes) {                  if (grep/^$attr$/,@changes) {
Line 800  sub print_footer { Line 807  sub print_footer {
 sub check_course {  sub check_course {
     my ($r,$dom,$domdesc) = @_;      my ($r,$dom,$domdesc) = @_;
     my ($ok_course,$description,$instcode,$owner);      my ($ok_course,$description,$instcode,$owner);
     if (defined($env{'form.pickedcourse'})) {      my %args = (
         my ($cdom,$cnum) = split(/_/,$env{'form.pickedcourse'});                   one_time => 1,
         if ($cdom eq $dom) {                 );
             my %courseIDs = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',      my %coursehash = 
                                                           $cnum,undef,undef,'.');          &Apache::lonnet::coursedescription($env{'form.pickedcourse'},\%args);
             if (keys(%courseIDs) > 0) {      my $cnum = $coursehash{'num'};
                 $ok_course = 'ok';      my $cdom = $coursehash{'domain'};
       if ($cdom eq $dom) {
           my $description;
           my %courseIDs = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',
                                              $cnum,undef,undef,'.');
           if (keys(%courseIDs) > 0) {
               $ok_course = 'ok';
               my ($instcode,$owner);
               if (ref($courseIDs{$cdom.'_'.$cnum}) eq 'HASH') {
                   $description = $courseIDs{$cdom.'_'.$cnum}{'description'};
                   $instcode = $courseIDs{$cdom.'_'.$cnum}{'inst_code'};
                   $owner = $courseIDs{$cdom.'_'.$cnum}{'owner'};          
               } else {
                 ($description,$instcode,$owner) =                   ($description,$instcode,$owner) = 
                                        split(/:/,$courseIDs{$cdom.'_'.$cnum});                                     split(/:/,$courseIDs{$cdom.'_'.$cnum});
                 $description = &unescape($description);              }
                 $instcode = &unescape($instcode);              $description = &unescape($description);
                 if ($instcode) {              $instcode = &unescape($instcode);
                     $description .= " ($instcode)";              if ($instcode) {
                 }                   $description .= " ($instcode)";
             }              }
               return ($ok_course,$description);
         }          }
     }      }
   
     if ($ok_course ne 'ok') {  
         $r->print('<br/>'.&mt('The LON-CAPA course selected was not a valid course for the [_1] domain',$domdesc));  
     }  
     return ($ok_course,$description);  
 }  }
   
 sub course_settings_descrip {  sub course_settings_descrip {
Line 926  sub handler { Line 941  sub handler {
                         }                          }
                     }                      }
                 } else {                  } else {
                     $r->print(&mt('The course you selected is not a valid course in this domain')." ($domdesc)");                       $r->print('<span class="LC_error">'.&mt('The course you selected is not a valid course in this domain')." ($domdesc)".'</span>'); 
                 }                  }
             }              }
         }          }

Removed from v.1.32  
changed lines
  Added in v.1.35


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