--- loncom/interface/lonmodifycourse.pm 2007/09/24 23:29:53 1.32 +++ loncom/interface/lonmodifycourse.pm 2007/10/03 19:57:29 1.33 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # handler for DC-only modifiable course settings # -# $Id: lonmodifycourse.pm,v 1.32 2007/09/24 23:29:53 raeburn Exp $ +# $Id: lonmodifycourse.pm,v 1.33 2007/10/03 19:57:29 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -368,7 +368,7 @@ all settings except course code, course } unless ($curr_authtype eq '') { $curr_authfield = $curr_authtype.'arg'; - } + } my $javascript_validations=&Apache::londropadd::javascript_validations('modifycourse',$krbdefdom,$curr_authtype,$curr_authfield); my %param = ( formname => 'document.cmod', kerb_def_dom => $krbdefdom, @@ -437,7 +437,7 @@ all settings except course code, course my $mainheader = &mt('Course settings modifiable by [_1] only.',$dctitle); my $hidden_elements = &hidden_form_elements(); $r->print(< +

$mainheader

@@ -561,9 +561,17 @@ sub modify_course { } if ($changeowner == 1 || $changecode == 1) { 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 => &escape($description), + inst_code => &escape($env{'form.coursecode'}), + owner => &escape($env{'form.courseowner'}), + type => &escape($type), + }, + ); + &Apache::lonnet::courseidput($cdom,\%courseid_entry, + &Apache::lonnet::homeserver($cnum,$cdom)); } - foreach my $param (@modifiable_params) { if ($currattr{$param} eq $newattr{$param}) { push(@nochanges,$param); @@ -573,17 +581,16 @@ sub modify_course { push(@changes,$param); } } - if (@changes > 0) { $chgresponse = &mt("The following automated enrollment parameters have been changed:
    "); } if (@nochanges > 0) { $nochgresponse = &mt("The following automated enrollment parameters remain unchanged:
      "); } - if (@changes > 0) { + if (@changes > 0) { my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,$cnum); if ($putreply !~ /^ok$/) { - $response = &mt("There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.
      "); + $response = &mt("There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.
      ").&mt('Error: ').$putreply; } else { foreach my $attr (@modifiable_params) { if (grep/^$attr$/,@changes) { @@ -804,11 +811,18 @@ sub check_course { my ($cdom,$cnum) = split(/_/,$env{'form.pickedcourse'}); if ($cdom eq $dom) { my %courseIDs = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.', - $cnum,undef,undef,'.'); + $cnum,undef,undef,'.'); if (keys(%courseIDs) > 0) { $ok_course = 'ok'; - ($description,$instcode,$owner) = + my ($description,$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) = split(/:/,$courseIDs{$cdom.'_'.$cnum}); + } $description = &unescape($description); $instcode = &unescape($instcode); if ($instcode) { @@ -817,10 +831,6 @@ sub check_course { } } } - - if ($ok_course ne 'ok') { - $r->print('
      '.&mt('The LON-CAPA course selected was not a valid course for the [_1] domain',$domdesc)); - } return ($ok_course,$description); } @@ -926,7 +936,7 @@ sub handler { } } } else { - $r->print(&mt('The course you selected is not a valid course in this domain')." ($domdesc)"); + $r->print(''.&mt('The course you selected is not a valid course in this domain')." ($domdesc)".''); } } }