[LON-CAPA-cvs] cvs: loncom /metadata_database searchcat.pl

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 11 Apr 2007 22:44:19 -0000


albertel		Wed Apr 11 18:44:19 2007 EDT

  Modified files:              
    /loncom/metadata_database	searchcat.pl 
  Log:
  - eliminate some copy/paste
  
  
Index: loncom/metadata_database/searchcat.pl
diff -u loncom/metadata_database/searchcat.pl:1.75 loncom/metadata_database/searchcat.pl:1.76
--- loncom/metadata_database/searchcat.pl:1.75	Tue Jan  2 07:52:22 2007
+++ loncom/metadata_database/searchcat.pl	Wed Apr 11 18:44:18 2007
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # searchcat.pl "Search Catalog" batch script
 #
-# $Id: searchcat.pl,v 1.75 2007/01/02 12:52:22 raeburn Exp $
+# $Id: searchcat.pl,v 1.76 2007/04/11 22:44:18 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,7 +68,7 @@
 use DBI;
 use lib '/home/httpd/lib/perl/';
 use LONCAPA::lonmetadata;
-
+use LONCAPA;
 use Getopt::Long;
 use IO::File;
 use HTML::TokeParser;
@@ -679,7 +679,7 @@
 ##   (copied from lond, modification of the return value)
 sub ishome {
     my $author=shift;
-    $author=~s/\/home\/httpd\/html\/res\/([^\/]*)\/([^\/]*).*/$1\/$2/;
+    $author=~s{/home/httpd/html/res/([^/]*)/([^/]*).*}{$1/$2};
     my ($udom,$uname)=split(/\//,$author);
     my $proname=propath($udom,$uname);
     if (-e $proname) {
@@ -690,20 +690,6 @@
 }
 
 ##
-## &propath($udom,$uname)
-##   Returns the path to the users LON-CAPA directory
-##   (copied from lond)
-sub propath {
-    my ($udom,$uname)=@_;
-    $udom=~s/\W//g;
-    $uname=~s/\W//g;
-    my $subdir=$uname.'__';
-    $subdir =~ s/(.)(.)(.).*/$1\/$2\/$3/;
-    my $proname="$Apache::lonnet::perlvar{'lonUsersDir'}/$udom/$subdir/$uname";
-    return $proname;
-} 
-
-##
 ## &declutter($filename)
 ##   Given a filename, returns a url for the filename.
 sub declutter {
@@ -714,16 +700,3 @@
     return $thisfn;
 }
 
-##
-## Escape / Unescape special characters
-sub unescape {
-    my $str=shift;
-    $str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
-    return $str;
-}
-
-sub escape {
-    my $str=shift;
-    $str =~ s/(\W)/"%".unpack('H2',$1)/eg;
-    return $str;
-}