[LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Wed, 21 May 2003 14:43:46 -0000
matthew Wed May 21 10:43:46 2003 EDT
Modified files:
/loncom/interface lonsearchcat.pm
Log:
trivial readability fix.
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.172 loncom/interface/lonsearchcat.pm:1.173
--- loncom/interface/lonsearchcat.pm:1.172 Mon Mar 17 13:35:51 2003
+++ loncom/interface/lonsearchcat.pm Wed May 21 10:43:46 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.172 2003/03/17 18:35:51 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.173 2003/05/21 14:43:46 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1618,30 +1618,26 @@
my @matches=($pattern=~/(\[[^\]|\[]*\])/g);
return $pattern unless @matches;
foreach my $match (@matches) {
- $match=~/\[ (\w+)\s(.*) \]/;
- my ($key,$value)=($1,$2);
- my $replacement='';
- if ($key eq 'literal') {
- $replacement="($dkey like \"\%$value\%\")";
- }
- elsif ($key eq 'not') {
- $value=~s/like/not like/;
-# $replacement="($dkey not like $value)";
- $replacement="$value";
- }
- elsif ($key eq 'and') {
- $value=~/(.*[\"|\)]) ([|\(|\^].*)/;
- $replacement="($1 AND $2)";
- }
- elsif ($key eq 'or') {
- $value=~/(.*[\"|\)]) ([|\(|\^].*)/;
- $replacement="($1 OR $2)";
+ $match=~/\[ (\w+)\s(.*) \]/;
+ my ($key,$value)=($1,$2);
+ my $replacement='';
+ if ($key eq 'literal') {
+ $replacement="($dkey like \"\%$value\%\")";
+ } elsif ($key eq 'not') {
+ $value=~s/like/not like/;
+# $replacement="($dkey not like $value)";
+ $replacement="$value";
+ } elsif ($key eq 'and') {
+ $value=~/(.*[\"|\)]) ([|\(|\^].*)/;
+ $replacement="($1 AND $2)";
+ } elsif ($key eq 'or') {
+ $value=~/(.*[\"|\)]) ([|\(|\^].*)/;
+ $replacement="($1 OR $2)";
}
substr($pattern,
- index($pattern,$match),
- length($match),
- $replacement
- );
+ index($pattern,$match),
+ length($match),
+ $replacement);
}
&recursive_SQL_query_build($dkey,$pattern);
}