Diff for /loncom/cgi/metadata_keywords.pl between versions 1.1 and 1.6

version 1.1, 2001/09/25 17:30:00 version 1.6, 2003/09/01 03:37:27
Line 1 Line 1
 #!/usr/bin/perl  #!/usr/bin/perl
   # Gets keywords from metadata database.
   # $Id$
 #  #
 # The LearningOnline Network with CAPA  # Copyright Michigan State University Board of Trustees
 #  #
 # Gets keywords from metadata database.  # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   #
   # LON-CAPA is free software; you can redistribute it and/or modify
   # it under the terms of the GNU General Public License as published by
   # the Free Software Foundation; either version 2 of the License, or
   # (at your option) any later version.
   #
   # LON-CAPA is distributed in the hope that it will be useful,
   # but WITHOUT ANY WARRANTY; without even the implied warranty of
   # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   # GNU General Public License for more details.
 #  #
 # YEAR=2001  # You should have received a copy of the GNU General Public License
 # 9/25 Scott Harrison  # along with LON-CAPA; if not, write to the Free Software
   # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #  #
   # /home/httpd/html/adm/gpl.txt
   #
   # http://www.lon-capa.org/
   #
   
   
 ###############################################################################  ###############################################################################
 ##                                                                           ##  ##                                                                           ##
Line 26 Line 44
 # 1=horrible 2=poor 3=fair 4=good 5=excellent  # 1=horrible 2=poor 3=fair 4=good 5=excellent
 # Organization 5  # Organization 5
 # Functionality 4  # Functionality 4
 # Has it been tested? 3  # Has it been tested? 4
 #  #
   
 # ------------------------------------------ Purpose and description of program  # ------------------------------------------ Purpose and description of program
Line 42 Line 60
 # should reflect this information) instead.  This is a speedier approach.  # should reflect this information) instead.  This is a speedier approach.
   
 # ------------------------------------------------- Modules used by this script  # ------------------------------------------------- Modules used by this script
   
   use lib '/home/httpd/lib/perl/';
   use LONCAPA::Configuration;
   
 use strict;  use strict;
 use DBI;  use DBI;
   
Line 51  print 'Content-type: text/plain'."\n\n"; Line 73  print 'Content-type: text/plain'."\n\n";
   
 # --- Make sure that database can be accessed and that this is a library server  # --- Make sure that database can be accessed and that this is a library server
 # library server test  # library server test
 my %perlvar;  
 open (CONFIG,"/etc/httpd/conf/access.conf") ||   # By default, loncapa_apache.conf is also read by the read_conf subroutine.
     (print "Can't read access.conf\n" && exit);  my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf');
 while (my $configline=<CONFIG>) {  my %perlvar=%{$perlvarref};
     if ($configline =~ /PerlSetVar/) {  undef($perlvarref);
  my ($dummy,$varname,$varvalue)=split(/\s+/,$configline);  
         chomp($varvalue);  
         $perlvar{$varname}=$varvalue;  
     }  
 }  
 close(CONFIG);  
 unless ($perlvar{'lonRole'} eq 'library') {  unless ($perlvar{'lonRole'} eq 'library') {
     print "This can only be run on a library server!\n";      print "This can only be run on a library server!\n";
     exit;      exit;
Line 80  my $dbh; Line 97  my $dbh;
 }  }
 %perlvar=(); # undefine it  %perlvar=(); # undefine it
   
 print "testmsg\n";  
 # ------------------------ Loop through database records and print out keywords  # ------------------------ Loop through database records and print out keywords
 my $sth=$dbh->prepare("select * from metadata");  my $sth=$dbh->prepare("select * from metadata");
 $sth->execute();  $sth->execute();
 my @row;  my @row;
 while (@row=$sth->fetchrow_array) {  while (@row=$sth->fetchrow_array) {
     print 'ROW:'.$row[4]."\n";      print $row[4]."\n";
 }  }
   
 # --------------------------------------------------- Close database connection  # --------------------------------------------------- Close database connection

Removed from v.1.1  
changed lines
  Added in v.1.6


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