Diff for /loncom/interface/loncreateuser.pm between versions 1.278 and 1.279

version 1.278, 2009/02/05 17:15:04 version 1.279, 2009/02/08 20:01:54
Line 227  sub build_tools_display { Line 227  sub build_tools_display {
                    'official'   => 'Can request creation of official courses',                     'official'   => 'Can request creation of official courses',
                    'unofficial' => 'Can request creation of unofficial courses',                       'unofficial' => 'Can request creation of unofficial courses',  
     );      );
     if ($context eq 'requestcourse') {      if ($context eq 'requestcourses') {
         %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,          %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
                       'requestcourse.official','requestcourse.unofficial');                        'requestcourses.official','requestcourses.unofficial');
         @usertools = ('official','unofficial');          @usertools = ('official','unofficial');
     } else {      } else {
         %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,          %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
Line 870  ENDCHANGEUSER Line 870  ENDCHANGEUSER
         if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {          if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
             $r->print('<h3>'.&mt('User Can Request Creation of Courses?').'</h3>'.              $r->print('<h3>'.&mt('User Can Request Creation of Courses?').'</h3>'.
                       &Apache::loncommon::start_data_table().                        &Apache::loncommon::start_data_table().
                       &build_tools_display($ccuname,$ccdomain,'requestcourse').                        &build_tools_display($ccuname,$ccdomain,'requestcourses').
                       &Apache::loncommon::end_data_table());                        &Apache::loncommon::end_data_table());
         }          }
         $r->print('</div>');          $r->print('</div>');
Line 1851  sub update_user_data { Line 1851  sub update_user_data {
                                                  \%changeHash,'tools');                                                   \%changeHash,'tools');
                 }                  }
             }              }
             if (&Apache::lonnet::allowed('ccc',$env{'request.domain'})) {              foreach my $item (@requestcourses) {
                 foreach my $item (@requestcourses) {                  $newcustom{$item} = $env{'form.requestcourses_'.$item};
                     $newcustom{$item} = $env{'form.requestcourse_'.$item};                  $changed{$item} = &tool_admin($item,$newcustom{$item},
                     $changed{$item} = &tool_admin($item,$newcustom{$item},                                                \%changeHash,'requestcourses');
                                                   \%changeHash,'requestcourse');  
                 }  
             }              }
             if (keys(%changed)) {              if (keys(%changed)) {
                 $changeHash{'firstname'}  = $env{'form.cfirstname'};                  $changeHash{'firstname'}  = $env{'form.cfirstname'};
Line 1902  sub update_user_data { Line 1900  sub update_user_data {
         my %userenv = &Apache::lonnet::get          my %userenv = &Apache::lonnet::get
             ('environment',['firstname','middlename','lastname','generation',              ('environment',['firstname','middlename','lastname','generation',
              'id','permanentemail','portfolioquota','inststatus','tools.aboutme',               'id','permanentemail','portfolioquota','inststatus','tools.aboutme',
              'tools.blog','tools.portfolio','requestcourse.official',               'tools.blog','tools.portfolio','requestcourses.official',
              'requestcourse.unofficial'],               'requestcourses.unofficial'],
               $env{'form.ccdomain'},$env{'form.ccuname'});                $env{'form.ccdomain'},$env{'form.ccuname'});
         my ($tmp) = keys(%userenv);          my ($tmp) = keys(%userenv);
         if ($tmp =~ /^(con_lost|error)/i) {           if ($tmp =~ /^(con_lost|error)/i) { 
Line 2084  sub update_user_data { Line 2082  sub update_user_data {
         }          }
         &tool_changes('tools',\@usertools,\%oldaccess,\%oldaccesstext,\%userenv,          &tool_changes('tools',\@usertools,\%oldaccess,\%oldaccesstext,\%userenv,
                       \%changeHash,\%changed,\%newaccess,\%newaccesstext);                        \%changeHash,\%changed,\%newaccess,\%newaccesstext);
         &tool_changes('requestcourse',\@requestcourses,\%oldaccess,\%oldaccesstext,          &tool_changes('requestcourses',\@requestcourses,\%oldaccess,\%oldaccesstext,
                       \%userenv, \%changeHash,\%changed,\%newaccess,\%newaccesstext);                        \%userenv, \%changeHash,\%changed,\%newaccess,\%newaccesstext);
         if ($env{'form.cfirstname'}  ne $userenv{'firstname'}  ||          if ($env{'form.cfirstname'}  ne $userenv{'firstname'}  ||
             $env{'form.cmiddlename'} ne $userenv{'middlename'} ||              $env{'form.cmiddlename'} ne $userenv{'middlename'} ||
Line 2112  sub update_user_data { Line 2110  sub update_user_data {
                         my %newenvhash;                          my %newenvhash;
                         foreach my $key (keys(%changed)) {                          foreach my $key (keys(%changed)) {
                             if (($key eq 'official') || ($key eq 'unofficial')) {                              if (($key eq 'official') || ($key eq 'unofficial')) {
                                 $newenvhash{'environment.canrequest.'.$key} =                                  $newenvhash{'environment.requestcourses.'.$key} =
                                     $changeHash{'requestcourse.'.$key};                                      $changeHash{'requestcourses.'.$key};
                                 $newenvhash{'environment.canrequest.'.$key} =                                  if ($changeHash{'requestcourses.'.$key} ne '') {
                                     $changeHash{'requestcourse.'.$key};                                      $newenvhash{'environment.canrequest.'.$key} =
                                           $changeHash{'requestcourses.'.$key};
                                   } else {
                                       $newenvhash{'environment.canrequest.'.$key} =
             &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
                                               $key,'reload','requestcourses');
                                   }
                             } elsif ($key ne 'quota') {                              } elsif ($key ne 'quota') {
                                 $newenvhash{'environment.tools.'.$key} =                                   $newenvhash{'environment.tools.'.$key} = 
                                     $changeHash{'tools.'.$key};                                      $changeHash{'tools.'.$key};
                                 $newenvhash{'environment.availabletools.'.$key} =                                  if ($changeHash{'tools.'.$key} ne '') {
                                     $changeHash{'tools.'.$key};                                      $newenvhash{'environment.availabletools.'.$key} =
                                           $changeHash{'tools.'.$key};
                                   } else {
                                       $newenvhash{'environment.availabletools.'.$key} =
             &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},                                            $key,'reload','tools');
                                   }
                             }                              }
                         }                          }
                         if (keys(%newenvhash)) {                          if (keys(%newenvhash)) {
Line 2397  sub tool_changes { Line 2405  sub tool_changes {
             } else {              } else {
                 $oldaccesstext->{$tool} = &mt("availability set to 'off'");                  $oldaccesstext->{$tool} = &mt("availability set to 'off'");
             }              }
             $changeHash->{$context.'.'.$tool} = $userenv->{'tools.'.$tool};              $changeHash->{$context.'.'.$tool} = $userenv->{$context.'.'.$tool};
             if ($env{'form.custom'.$tool} == 1) {              if ($env{'form.custom'.$tool} == 1) {
                 if ($env{'form.'.$context.'_'.$tool} ne $userenv->{'tools.'.$tool}) {                  if ($env{'form.'.$context.'_'.$tool} ne $userenv->{$context.'.'.$tool}) {
                     $changed->{$tool} = &tool_admin($tool,$env{'form.'.$context.'_'.$tool},                      $changed->{$tool} = &tool_admin($tool,$env{'form.'.$context.'_'.$tool},
                                                   $changeHash,$context);                                                    $changeHash,$context);
                     if ($changed->{$tool}) {                      if ($changed->{$tool}) {
Line 2823  sub quota_admin { Line 2831  sub quota_admin {
 sub tool_admin {  sub tool_admin {
     my ($tool,$settool,$changeHash,$context) = @_;      my ($tool,$settool,$changeHash,$context) = @_;
     my $canchange = 0;       my $canchange = 0; 
     if ($context eq 'requestcourse') {      if ($context eq 'requestcourses') {
         if (&Apache::lonnet::allowed('ccc',$env{'form.ccdomain'})) {          if (&Apache::lonnet::allowed('ccc',$env{'form.ccdomain'})) {
             $canchange = 1;              $canchange = 1;
         }          }
Line 4239  sub update_selfenroll_queue { Line 4247  sub update_selfenroll_queue {
                 &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'}).' ('.$env{'user.name'}.':'.$env{'user.domain'}.')';                  &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'}).' ('.$env{'user.name'}.':'.$env{'user.domain'}.')';
             my $chgmsg = "'Action was taken on the following enrollment requests by [_1].',$namelink";              my $chgmsg = "'Action was taken on the following enrollment requests by [_1].',$namelink";
             my ($approvedlist,$rejectedlist);              my ($approvedlist,$rejectedlist);
             if (@enrolled) {               if (@enrolled) {
                 $approvedlist = join("\n",@enrolled);                  $approvedlist = join("\n",@enrolled);
                 $r->print('<p>'.&mt('The following were enrolled in the course:').'<ul>');                  $r->print('<p>'.&mt('The following were enrolled in the course:').'<ul>');
                 foreach my $user (@enrolled) {                  foreach my $user (@enrolled) {

Removed from v.1.278  
changed lines
  Added in v.1.279


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