Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.700 and 1.703

version 1.700, 2006/01/12 21:12:55 version 1.703, 2006/01/26 07:14:39
Line 1358  sub finishuserfileupload { Line 1358  sub finishuserfileupload {
     }      }
 # Save the file  # Save the file
     {      {
  open(FH,'>'.$filepath.'/'.$file);   if (!open(FH,'>'.$filepath.'/'.$file)) {
  print FH $env{'form.'.$formname};      &logthis('Failed to create '.$filepath.'/'.$file);
       print STDERR ('Failed to create '.$filepath.'/'.$file."\n");
       return '/adm/notfound.html';
    }
    if (!print FH ($env{'form.'.$formname})) {
       &logthis('Failed to write to '.$filepath.'/'.$file);
       print STDERR ('Failed to write to '.$filepath.'/'.$file."\n");
       return '/adm/notfound.html';
    }
  close(FH);   close(FH);
     }      }
     if ($parser eq 'parse') {      if ($parser eq 'parse') {
Line 2785  sub del { Line 2793  sub del {
 # -------------------------------------------------------------- dump interface  # -------------------------------------------------------------- dump interface
   
 sub dump {  sub dump {
    my ($namespace,$udomain,$uname,$regexp)=@_;     my ($namespace,$udomain,$uname,$regexp,$range)=@_;
    if (!$udomain) { $udomain=$env{'user.domain'}; }     if (!$udomain) { $udomain=$env{'user.domain'}; }
    if (!$uname) { $uname=$env{'user.name'}; }     if (!$uname) { $uname=$env{'user.name'}; }
    my $uhome=&homeserver($uname,$udomain);     my $uhome=&homeserver($uname,$udomain);
Line 2794  sub dump { Line 2802  sub dump {
    } else {     } else {
        $regexp='.';         $regexp='.';
    }     }
    my $rep=reply("dump:$udomain:$uname:$namespace:$regexp",$uhome);     my $rep=reply("dump:$udomain:$uname:$namespace:$regexp:$range",$uhome);
    my @pairs=split(/\&/,$rep);     my @pairs=split(/\&/,$rep);
    my %returnhash=();     my %returnhash=();
    foreach (@pairs) {     foreach (@pairs) {
       my ($key,$value)=split(/=/,$_);        my ($key,$value)=split(/=/,$_,2);
       $returnhash{unescape($key)}=&thaw_unescape($value);        $returnhash{unescape($key)}=&thaw_unescape($value);
    }     }
    return %returnhash;     return %returnhash;
Line 5323  sub get_slot { Line 5331  sub get_slot {
  $cdom=$env{'course.'.$courseid.'.domain'};   $cdom=$env{'course.'.$courseid.'.domain'};
  $cnum=$env{'course.'.$courseid.'.num'};   $cnum=$env{'course.'.$courseid.'.num'};
     }      }
     my %slotinfo=&get('slots',[$which],$cdom,$cnum);      my $key=join("\0",'slots',$cdom,$cnum,$which);
     &Apache::lonhomework::showhash(%slotinfo);      my %slotinfo;
     my ($tmp)=keys(%slotinfo);      if (exists($remembered{$key})) {
     if ($tmp=~/^error:/) { return (); }   $slotinfo{$which} = $remembered{$key};
       } else {
    %slotinfo=&get('slots',[$which],$cdom,$cnum);
    &Apache::lonhomework::showhash(%slotinfo);
    my ($tmp)=keys(%slotinfo);
    if ($tmp=~/^error:/) { return (); }
    $remembered{$key} = $slotinfo{$which};
       }
     if (ref($slotinfo{$which}) eq 'HASH') {      if (ref($slotinfo{$which}) eq 'HASH') {
  return %{$slotinfo{$which}};   return %{$slotinfo{$which}};
     }      }
Line 7040  namesp ($udom and $uname are optional) Line 7055  namesp ($udom and $uname are optional)
   
 =item *  =item *
   
 dump($namespace,$udom,$uname,$regexp) :   dump($namespace,$udom,$uname,$regexp,$range) : 
 dumps the complete (or key matching regexp) namespace into a hash  dumps the complete (or key matching regexp) namespace into a hash
 ($udom, $uname and $regexp are optional)  ($udom, $uname, $regexp, $range are optional)
   
   $range should be either an integer '100' (give me the first 100
                                              matching records)
                 or be  two integers sperated by a - with no spaces
                    '30-50' (give me the 30th through the 50th matching
                             records)
 =item *  =item *
   
 inc($namespace,$store,$udom,$uname) : increments $store in $namespace.  inc($namespace,$store,$udom,$uname) : increments $store in $namespace.

Removed from v.1.700  
changed lines
  Added in v.1.703


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