Diff for /loncom/interface/groupsort.pm between versions 1.4 and 1.7

version 1.4, 2001/12/11 03:19:16 version 1.7, 2002/03/21 14:33:49
Line 28 Line 28
 #  #
 # YEAR=2001  # YEAR=2001
 # 8/7,8/8,10/14,10/15,12/10 Scott Harrison  # 8/7,8/8,10/14,10/15,12/10 Scott Harrison
   # YEAR=2002
   # 1/17 Scott Harrison
 #  #
 ###  ###
   
Line 87  function finish_import() { Line 89  function finish_import() {
     opener.editmode=0;      opener.editmode=0;
     opener.notclear=0;      opener.notclear=0;
     opener.linkmode=0;      opener.linkmode=0;
     opener.infoclear();  
     opener.draw();      opener.draw();
     self.close();      self.close();
 }  }
Line 114  END Line 115  END
   
     my %shash; # sort order (key is resource location, value is sort order)      my %shash; # sort order (key is resource location, value is sort order)
     my %thash; # title (key is resource location, value is title)      my %thash; # title (key is resource location, value is title)
     map {      foreach (split(/&/,$ENV{'QUERY_STRING'})) {
        my ($name, $value) = split(/=/,$_);         my ($name, $value) = split(/=/,$_);
        $value =~ tr/+/ /;         $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;         $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
Line 124  END Line 125  END
        if ($name eq 'catalogmode') {         if ($name eq 'catalogmode') {
            $ENV{'form.'.$name}=$value;             $ENV{'form.'.$name}=$value;
        }         }
     } (split(/&/,$ENV{'QUERY_STRING'}));      }
     my $diropendb;      my $diropendb;
     if ($ENV{'form.catalogmode'} eq 'groupsearch') {      if ($ENV{'form.catalogmode'} eq 'groupsearch') {
  $diropendb =    $diropendb = 
Line 134  END Line 135  END
  $diropendb =    $diropendb = 
     "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db";      "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db";
     }      }
       else { # choose last accessed
    my $dsearch; my $dindex;
    my $dsearcht; my $dindext;
    $dsearch =
       "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_searchcat.db";
    if (-e $dsearch) {
       $dsearcht=(stat($dsearch))[9];
    }
    $dindex =
               "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db";
    if (-e $dindex) {
               $dindext=(stat($dindex))[9];
           }
    if (!$dsearcht and !$dindext) {
       $diropendb='';
    }
           elsif ($dsearcht>$dindext) {
               $diropendb=$dsearch;
           }
    else {
               $diropendb=$dindex;
    }
       }
     if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT,0640)) {      if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT,0640)) {
  my $acts = $ENV{'form.acts'};   my $acts = $ENV{'form.acts'};
  my @Acts = split(/b/,$acts);   my @Acts = split(/b/,$acts);
  my %ahash;   my %ahash;
  my %achash;   my %achash;
  my $ac = 0;   my $ac = 0;
  map {   foreach (@Acts) {
     my ($state,$ref) = split(/a/);      my ($state,$ref) = split(/a/);
     $ahash{$ref} = $state;      $ahash{$ref} = $state;
     $achash{$ref} = $ac;      $achash{$ref} = $ac;
     $ac++;      $ac++;
  } (@Acts);   }
  map {   foreach (sort {$achash{$a} <=> $achash{$b}} (keys %ahash)) {
     my $key = $_;      my $key = $_;
     if ($ahash{$key} eq '1') {      if ($ahash{$key} eq '1') {
 # my $keyz=join("<br />",keys %hash);  # my $keyz=join("<br />",keys %hash);
Line 162  END Line 186  END
     delete $hash{'store_'.$hash{'pre_'.$key.'_link'}};      delete $hash{'store_'.$hash{'pre_'.$key.'_link'}};
  }   }
     }      }
  } sort {$achash{$a} <=> $achash{$b}} (keys %ahash);   }
  map {   foreach (keys %hash) {
     if ($_ =~ /^store_/) {      if ($_ =~ /^store_/) {
  my $key = $_;   my $key = $_;
  $key =~ s/^store_//;   $key =~ s/^store_//;
  $shash{$key} = $hash{'storectr_'.$key};   $shash{$key} = $hash{'storectr_'.$key};
  $thash{$key} = $hash{'store_'.$key};   $thash{$key} = $hash{'store_'.$key};
     }      }
  } keys %hash;   }
  if ($ENV{'form.oldval'}) {   if ($ENV{'form.oldval'}) {
     my $newctr = 0;      my $newctr = 0;
     my %chash;      my %chash;
     map {      foreach (sort {$shash{$a} <=> $shash{$b}} (keys %shash)) {
  my $key = $_;   my $key = $_;
  $newctr++;   $newctr++;
  $shash{$key} = $newctr;   $shash{$key} = $newctr;
  $hash{'storectr_'.$key} = $newctr;   $hash{'storectr_'.$key} = $newctr;
  $chash{$newctr} = $key;   $chash{$newctr} = $key;
     } sort {$shash{$a} <=> $shash{$b}} (keys %shash);      }
     my $oldval = $ENV{'form.oldval'};      my $oldval = $ENV{'form.oldval'};
     my $newval = $ENV{'form.newval'};      my $newval = $ENV{'form.newval'};
     if ($oldval != $newval) {      if ($oldval != $newval) {
Line 258  END Line 282  END
       "\n");        "\n");
     $r->print("<td colspan='2' bgcolor='$titleclr'><b>Title</b></td>\n");      $r->print("<td colspan='2' bgcolor='$titleclr'><b>Title</b></td>\n");
     $r->print("<td bgcolor='$titleclr'><b>Path</b></td></tr>\n");      $r->print("<td bgcolor='$titleclr'><b>Path</b></td></tr>\n");
     map {      foreach (sort {$shash{$a}<=>$shash{$b}} (keys %shash)) {
  my $key=$_;   my $key=$_;
  $ctr++;   $ctr++;
  my @file_ext = split(/\./,$key);   my @file_ext = split(/\./,$key);
Line 273  END Line 297  END
  $r->print("</td><td bgcolor='$fileclr'>");   $r->print("</td><td bgcolor='$fileclr'>");
  $r->print("$thash{$key}</td><td bgcolor='$fileclr'>\n");   $r->print("$thash{$key}</td><td bgcolor='$fileclr'>\n");
  $r->print("$key</td></tr>\n");   $r->print("$key</td></tr>\n");
     } sort {$shash{$a}<=>$shash{$b}} (keys %shash);      } 
     $r->print("</table></td></tr></table></form>");      $r->print("</table></td></tr></table></form>");
     $r->print(<<END);      $r->print(<<END);
 </body>  </body>

Removed from v.1.4  
changed lines
  Added in v.1.7


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