Diff for /loncom/interface/loncommon.pm between versions 1.907 and 1.908

version 1.907, 2009/10/31 16:17:07 version 1.908, 2009/11/03 03:18:21
Line 6971  sub check_user_status { Line 6971  sub check_user_status {
     my $active_chk = 'none';      my $active_chk = 'none';
     my $now = time;      my $now = time;
     if (@uroles > 0) {      if (@uroles > 0) {
         if (($role eq 'cc') || ($sec eq '') || (!defined($sec))) {          if (($role eq 'cc') || ($role eq 'co') || ($sec eq '') || (!defined($sec))) {
             $srchstr = '/'.$cdom.'/'.$crs.'_'.$role;              $srchstr = '/'.$cdom.'/'.$crs.'_'.$role;
         } else {          } else {
             $srchstr = '/'.$cdom.'/'.$crs.'/'.$sec.'_'.$role;              $srchstr = '/'.$cdom.'/'.$crs.'/'.$sec.'_'.$role;
Line 9923  sub check_clone { Line 9923  sub check_clone {
     my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom);      my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom);
     my $clonemsg;      my $clonemsg;
     my $can_clone = 0;      my $can_clone = 0;
       my $lctype = lc($args->{'type'});
       if ($lctype ne 'community') {
           $lctype = 'course';
       }
     if ($clonehome eq 'no_host') {      if ($clonehome eq 'no_host') {
         $clonemsg = &mt('No new course created.').$linefeed.&mt('A new course could not be cloned from the specified original - [_1] - because it is a non-existent course.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});               if ($args->{'type'} eq 'Community') {
               $clonemsg = &mt('No new community created.').$linefeed.&mt('A new community could not be cloned from the specified original - [_1] - because it is a non-existent community.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});
           } else {
               $clonemsg = &mt('No new course created.').$linefeed.&mt('A new course could not be cloned from the specified original - [_1] - because it is a non-existent course.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});
           }     
     } else {      } else {
  my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1});   my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1});
           if ($args->{'type'} eq 'Community') {
               if ($clonedesc{'type'} ne 'Community') {
                    $clonemsg = &mt('No new community created.').$linefeed.&mt('A new community could not be cloned from the specified original - [_1] - because it is a course not a community.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});
                   return ($can_clone, $clonemsg, $cloneid, $clonehome);
               }
           }
  if (($env{'request.role.domain'} eq $args->{'clonedomain'}) &&    if (($env{'request.role.domain'} eq $args->{'clonedomain'}) && 
             (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'}))) {              (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'}))) {
     $can_clone = 1;      $can_clone = 1;
Line 9940  sub check_clone { Line 9953  sub check_clone {
             } elsif (grep(/^\*\:\Q$args->{'ccdomain'}\E$/,@cloners)) {              } elsif (grep(/^\*\:\Q$args->{'ccdomain'}\E$/,@cloners)) {
                 $can_clone = 1;                  $can_clone = 1;
             } else {              } else {
                   my $ccrole = 'cc';
                   if ($args->{'type'} eq 'Community') {
                       $ccrole = 'co';
                   }
         my %roleshash =          my %roleshash =
     &Apache::lonnet::get_my_roles($args->{'ccuname'},      &Apache::lonnet::get_my_roles($args->{'ccuname'},
  $args->{'ccdomain'},   $args->{'ccdomain'},
                                          'userroles',['active'],['cc'],                                           'userroles',['active'],[$ccrole],
  [$args->{'clonedomain'}]);   [$args->{'clonedomain'}]);
         if (($roleshash{$args->{'clonecourse'}.':'.$args->{'clonedomain'}.':cc'}) || (grep(/^\Q$args->{'ccuname'}\E:\Q$args->{'ccdomain'}\E$/,@cloners))) {          if (($roleshash{$args->{'clonecourse'}.':'.$args->{'clonedomain'}.':'.$ccrole}) || (grep(/^\Q$args->{'ccuname'}\E:\Q$args->{'ccdomain'}\E$/,@cloners))) {
     $can_clone = 1;      $can_clone = 1;
         } else {          } else {
                     $clonemsg = &mt('No new course created.').$linefeed.&mt('The new course could not be cloned from the existing course because the new course owner ([_1]) does not have cloning rights in the existing course ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'});                      if ($args->{'type'} eq 'Community') {
                           $clonemsg = &mt('No new community created.').$linefeed.&mt('The new community could not be cloned from the existing community because the new community owner ([_1]) does not have cloning rights in the existing community ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'});
                       } else {
                           $clonemsg = &mt('No new course created.').$linefeed.&mt('The new course could not be cloned from the existing course because the new course owner ([_1]) does not have cloning rights in the existing course ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'});
                       }
         }          }
     }      }
         }          }

Removed from v.1.907  
changed lines
  Added in v.1.908


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