--- loncom/metadata_database/searchcat.pl 2003/12/25 13:11:56 1.48 +++ loncom/metadata_database/searchcat.pl 2003/12/27 23:04:28 1.53 @@ -2,7 +2,7 @@ # The LearningOnline Network # searchcat.pl "Search Catalog" batch script # -# $Id: searchcat.pl,v 1.48 2003/12/25 13:11:56 www Exp $ +# $Id: searchcat.pl,v 1.53 2003/12/27 23:04:28 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -134,7 +134,7 @@ sub dynamicmeta { 'count' => 0, 'course' => 0, 'course_list' => '', - 'avetries' => 0, + 'avetries' => 'NULL', 'avetries_list' => '', 'stdno' => 0, 'stdno_list' => '', @@ -144,8 +144,14 @@ sub dynamicmeta { 'goto_list' => '', 'comefrom' => 0, 'comefrom_list' => '', - 'difficulty' => 0, - 'difficulty_list' => '' + 'difficulty' => 'NULL', + 'difficulty_list' => '', + 'clear' => 'NULL', + 'technical' => 'NULL', + 'correct' => 'NULL', + 'helpful' => 'NULL', + 'depth' => 'NULL', + 'comments' => '' ); my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//); my $prodir=&propath($adomain,$aauthor); @@ -182,19 +188,19 @@ sub dynamicmeta { if (defined($cnt{$cat})) { $cnt{$cat}++; } else { $cnt{$cat}=1; } unless ($listitems{$cat} eq 'app') { if (defined($sum{$cat})) { - $sum{$cat}+=$evaldata{$esckey}; + $sum{$cat}+=&unescape($evaldata{$esckey}); $concat{$cat}.=','.$item; } else { - $sum{$cat}=$evaldata{$esckey}; + $sum{$cat}=&unescape($evaldata{$esckey}); $concat{$cat}=$item; } } else { if (defined($sum{$cat})) { if ($evaldata{$esckey}=~/\w/) { - $sum{$cat}.='
'.$evaldata{$esckey}; + $sum{$cat}.='
'.&unescape($evaldata{$esckey}); } } else { - $sum{$cat}=''.$evaldata{$esckey}; + $sum{$cat}=''.&unescape($evaldata{$esckey}); } } } @@ -235,7 +241,7 @@ sub dynamicmeta { # --------------- Read loncapa_apache.conf and loncapa.conf and get variables my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf'); my %perlvar=%{$perlvarref}; -undef $perlvarref; # remove since sensitive and not needed +undef $perlvarref; delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed # ------------------------------------- Only run if machine is a library server @@ -276,7 +282,10 @@ my $dbh; "title TEXT, author TEXT, subject TEXT, url TEXT, keywords TEXT, ". "version TEXT, notes TEXT, abstract TEXT, mime TEXT, language TEXT, ". "creationdate DATETIME, lastrevisiondate DATETIME, owner TEXT, ". - "copyright TEXT, ". + "copyright TEXT, dependencies TEXT, ". + "modifyinguser TEXT, authorspace TEXT, ". + "lowestgradelevel INTEGER UNSIGNED, highestgradelevel INTEGER UNSIGNED, ". + "standards TEXT, ". "count INTEGER UNSIGNED, ". "course INTEGER UNSIGNED, course_list TEXT, ". "goto INTEGER UNSIGNED, goto_list TEXT, ". @@ -285,13 +294,18 @@ my $dbh; "stdno INTEGER UNSIGNED, stdno_list TEXT, ". "avetries FLOAT, avetries_list TEXT, ". "difficulty FLOAT, difficulty_list TEXT, ". + "clear FLOAT, technical FLOAT, correct FLOAT, helpful FLOAT, depth FLOAT, ". + "comments TEXT, ". +# For backward compatibility, only insert new fields below +# ... +# For backward compatibility, end new fields above "FULLTEXT idx_title (title), ". "FULLTEXT idx_author (author), FULLTEXT idx_subject (subject), ". "FULLTEXT idx_url (url), FULLTEXT idx_keywords (keywords), ". - "FULLTEXT idx_version (version), FULLTEXT idx_notes (notes), ". + "FULLTEXT idx_notes (notes), ". "FULLTEXT idx_abstract (abstract), FULLTEXT idx_mime (mime), ". - "FULLTEXT idx_language (language), FULLTEXT idx_owner (owner), ". - "FULLTEXT idx_copyright (copyright)) ". + "FULLTEXT idx_owner (owner), ". + "FULLTEXT idx_standards (standards))". "TYPE=MyISAM"; # It would sure be nice to have some logging mechanism. unless ($dbh->do($make_metadata_table)) { @@ -326,6 +340,12 @@ my $insert_sth = $dbh->prepare "?,". # revisiondate "?,". # owner "?,". # copyright + "?,". # dependencies + "?,". # modifyinguser + "?,". # authorspace + "?,". # lowestgradelevel + "?,". # highestgradelevel + "?,". # standards "?,". # count "?,". # course "?,". # course_list @@ -340,7 +360,13 @@ my $insert_sth = $dbh->prepare "?,". # avetries "?,". # avetries_list "?,". # difficulty - "?". # difficulty_list + "?,". # difficulty_list + "?,". # clear + "?,". # technical + "?,". # correct + "?,". # helpful + "?,". # depth + "?". # comments ")" ); @@ -379,6 +405,12 @@ foreach my $user (@homeusers) { sqltime($ref->{'lastrevisiondate'}), $ref->{'owner'}, $ref->{'copyright'}, + $ref->{'dependencies'}, + $ref->{'modifyinguser'}, + $ref->{'authorspace'}, + $ref->{'lowestgradelevel'}, + $ref->{'highestgradelevel'}, + $ref->{'standards'}, $dyn{'count'}, $dyn{'course'}, $dyn{'course_list'}, @@ -393,7 +425,13 @@ foreach my $user (@homeusers) { $dyn{'avetries'}, $dyn{'avetries_list'}, $dyn{'difficulty'}, - $dyn{'difficulty_list'} + $dyn{'difficulty_list'}, + $dyn{'clear'}, + $dyn{'technical'}, + $dyn{'correct'}, + $dyn{'helpful'}, + $dyn{'depth'}, + $dyn{'comments'} )) { print LOG "\nMySQL Error Insert: ".$dbh->errstr."\n"; die $dbh->errstr;