Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.682 and 1.683.2.3

version 1.682, 2005/11/21 19:08:29 version 1.683.2.3, 2005/12/22 20:57:49
Line 40  qw(%perlvar %hostname %badServerCache %i Line 40  qw(%perlvar %hostname %badServerCache %i
    %courselogs %accesshash %userrolehash %domainrolehash $processmarker $dumpcount      %courselogs %accesshash %userrolehash %domainrolehash $processmarker $dumpcount 
    %coursedombuf %coursenumbuf %coursehombuf %coursedescrbuf %courseinstcodebuf %courseownerbuf     %coursedombuf %coursenumbuf %coursehombuf %coursedescrbuf %courseinstcodebuf %courseownerbuf
    %domaindescription %domain_auth_def %domain_auth_arg_def      %domaindescription %domain_auth_def %domain_auth_arg_def 
    %domain_lang_def %domain_city %domain_longi %domain_lati $tmpdir $_64bit     %domain_lang_def %domain_city %domain_longi %domain_lati %domain_primary
    %env);     $tmpdir $_64bit %env);
   
 use IO::Socket;  use IO::Socket;
 use GDBM_File;  use GDBM_File;
Line 1853  sub courseiddump { Line 1853  sub courseiddump {
 # ---------------------------------------------------------- DC e-mail  # ---------------------------------------------------------- DC e-mail
   
 sub dcmailput {  sub dcmailput {
     my ($domain,$msgid,$contents,$server)=@_;      my ($domain,$msgid,$message,$server)=@_;
     my $status = &Apache::lonnet::critical(      my $status = &Apache::lonnet::critical(
        'dcmailput:'.$domain.':'.&Apache::lonnet::escape($msgid).'='.         'dcmailput:'.$domain.':'.&Apache::lonnet::escape($msgid).'='.
        &Apache::lonnet::escape($$contents{$server}),$server);         &Apache::lonnet::escape($message),$server);
     return $status;      return $status;
 }  }
   
 sub dcmaildump {  sub dcmaildump {
     my ($dom,$startdate,$enddate,$senders) = @_;      my ($dom,$startdate,$enddate,$senders) = @_;
     my %returnhash=();       my %returnhash=();
     foreach my $tryserver (keys(%libserv)) {      if (exists($domain_primary{$dom})) {
         if ($hostdom{$tryserver} eq $dom) {          my $cmd='dcmaildump:'.$dom.':'.&escape($startdate).':'.
             %{$returnhash{$tryserver}}=();                                                           &escape($enddate).':';
     my $cmd='dcmaildump:'.$dom.':'.   my @esc_senders=map { &escape($_)} @$senders;
  &escape($startdate).':'.&escape($enddate).':';   $cmd.=&escape(join('&',@esc_senders));
     my @esc_senders=map { &escape($_)} @$senders;   foreach (split(/\&/,&reply($cmd,$domain_primary{$dom}))) {
     $cmd.=&escape(join('&',@esc_senders));              my ($key,$value) = split(/\=/,$_);
     foreach (split(/\&/,&reply($cmd,$tryserver))) {              if (($key) && ($value)) {
                 my ($key,$value) = split(/\=/,$_);                  $returnhash{&unescape($key)} = &unescape($value);
                 if (($key) && ($value)) {  
                     $returnhash{$tryserver}{&unescape($key)} = &unescape($value);  
                 }  
             }              }
         }          }
     }      }
Line 3703  sub auto_instcode_format { Line 3700  sub auto_instcode_format {
 # ------------------------------------------------------- Course Group routines  # ------------------------------------------------------- Course Group routines
   
 sub get_coursegroups {  sub get_coursegroups {
     my ($cdom,$cnum,$curr_groups,$group) = @_;      my ($cdom,$cnum,$group) = @_;
     my $numgroups = 0;      return(&dump('coursegroups',$cdom,$cnum,$group));
     %{$curr_groups} = &dump('coursegroups',$cdom,$cnum,$group);  
     my ($tmp)=keys(%{$curr_groups});  
     if ($tmp eq 'error: 2 tie(GDBM) Failed while attempting dump') {  
         my %emptyhash = ();  
         if (&put('coursegroups',\%emptyhash,$cdom,$cnum) eq 'ok') {  
             %{$curr_groups} = &dump('coursegroups',$cdom,$cnum,$group);  
             $tmp=keys(%{$curr_groups});  
         }  
     }  
     if ($tmp=~/^error:/) {  
         &logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'.$cdom);  
     } else {  
         my @groups = keys(%{$curr_groups});  
         $numgroups = @groups;  
     }  
     return $numgroups;  
 }  }
   
 sub modify_coursegroup {  sub modify_coursegroup {
Line 3760  sub get_active_groups { Line 3741  sub get_active_groups {
     return %groups;      return %groups;
 }  }
   
   sub get_group_membership {
       my ($cdom,$cnum,$group) = @_;
       return(&dump('groupmembership',$cdom,$cnum,$group));
   }
   
   sub get_users_groups {
       my ($udom,$uname,$courseid) = @_;
       my $cachetime=1800;
       $courseid=~s/\_/\//g;
       $courseid=~s/^(\w)/\/$1/;
   
       my $hashid="$udom:$uname:$courseid";
       my ($result,$cached)=&is_cached_new('getgroups',$hashid);
       if (defined($cached)) { return $result; }
   
       my %roleshash = &dump('roles',$udom,$uname,$courseid);
       my ($tmp) = keys(%roleshash);
       if ($tmp=~/^error:/) {
           &logthis('Error retrieving roles: '.$tmp.' for '.$uname.':'.$udom);
           return '';
       } else {
           my $grouplist;
           foreach my $key (keys %roleshash) {
               if ($key =~ /^\Q$courseid\E\/(\w+)\_gr$/) {
                   unless ($roleshash{$key} =~ /_1_1$/) {   # deleted membership
                       $grouplist .= $1.':';
                   }
               }
           }
           $grouplist =~ s/:$//;
           return &do_cache_new('getgroups',$hashid,$grouplist,$cachetime);
       }
   }
   
   sub devalidate_getgroups_cache {
       my ($udom,$uname,$cdom,$cnum)=@_;
       my $courseid = $cdom.'_'.$cnum;
       $courseid=~s/\_/\//g;
       $courseid=~s/^(\w)/\/$1/;
       my $hashid="$udom:$uname:$courseid";
       &devalidate_cache_new('getgroups',$hashid);
   }
   
 # ------------------------------------------------------------------ Plain Text  # ------------------------------------------------------------------ Plain Text
   
 sub plaintext {  sub plaintext {
Line 5385  sub symbread { Line 5409  sub symbread {
         if ( ($thisfn =~ m/^(uploaded|editupload)\//) && ($thisfn !~ m/\.(page|sequence)$/) ) {          if ( ($thisfn =~ m/^(uploaded|editupload)\//) && ($thisfn !~ m/\.(page|sequence)$/) ) {
             $targetfn = 'adm/wrapper/'.$thisfn;              $targetfn = 'adm/wrapper/'.$thisfn;
         }          }
    if ($targetfn =~ m|^adm/wrapper/(ext/.*)|) {
       $targetfn=$1;
    }
         if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',          if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
                       &GDBM_READER(),0640)) {                        &GDBM_READER(),0640)) {
     $syval=$hash{$targetfn};      $syval=$hash{$targetfn};
Line 6158  BEGIN { Line 6185  BEGIN {
 #           next if /^\#/;  #           next if /^\#/;
            chomp;             chomp;
            my ($domain, $domain_description, $def_auth, $def_auth_arg,             my ($domain, $domain_description, $def_auth, $def_auth_arg,
        $def_lang, $city, $longi, $lati) = split(/:/,$_);         $def_lang, $city, $longi, $lati, $primary) = split(/:/,$_);
    $domain_auth_def{$domain}=$def_auth;     $domain_auth_def{$domain}=$def_auth;
            $domain_auth_arg_def{$domain}=$def_auth_arg;             $domain_auth_arg_def{$domain}=$def_auth_arg;
    $domaindescription{$domain}=$domain_description;     $domaindescription{$domain}=$domain_description;
Line 6166  BEGIN { Line 6193  BEGIN {
    $domain_city{$domain}=$city;     $domain_city{$domain}=$city;
    $domain_longi{$domain}=$longi;     $domain_longi{$domain}=$longi;
    $domain_lati{$domain}=$lati;     $domain_lati{$domain}=$lati;
              $domain_primary{$domain}=$primary;
   
  #         &logthis("Domain.tab: $domain, $domain_auth_def{$domain}, $domain_auth_arg_def{$domain},$domaindescription{$domain}");   #         &logthis("Domain.tab: $domain, $domain_auth_def{$domain}, $domain_auth_arg_def{$domain},$domaindescription{$domain}");
 #          &logthis("Domain.tab: $domain ".$domaindescription{$domain} );  #          &logthis("Domain.tab: $domain ".$domaindescription{$domain} );
Line 6192  BEGIN { Line 6220  BEGIN {
     }      }
     close($config);      close($config);
     # FIXME: dev server don't want this, production servers _do_ want this      # FIXME: dev server don't want this, production servers _do_ want this
     #&get_iphost();      &get_iphost();
 }  }
   
 sub get_iphost {  sub get_iphost {

Removed from v.1.682  
changed lines
  Added in v.1.683.2.3


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