Home : Products : DBMan : Customization :

Products: DBMan: Customization: Re: [Fabianope] Still about merging fields: Edit Log

Here is the list of edits for this post
Re: [Fabianope] Still about merging fields
This has been bothering me for a while. I am also a librarian and use dbman for the exact same purpose as you. Making two fields, a long title and a short title would be way too much work and make the database much larger than needed.

Here is a script you can install independently which will solve the problem. I am working on a way to integrate it into the html.pl file, but until then, this seems to work okay. Go to

http://www.lib.lsu.edu/...rid/journalfind2.cgi?

and try The Economist and Economist in the top input box to try it out. The sorting isn't right- it still falls under The, but at least it shows up.

Here's the script. I am going to keep working on it and will post more if I can come up with an improvement, but maybe this will get you started, or give you an idea for something more useful to share.

Code:


#! /usr/sbin/perl

############ Advanced Options
print "Content-type: text/html\n\n";

#############################

use LWP::Simple;
&Parse_Form;
$search = $formdata{'search'};

$search =~ s/the //g;
$search =~ s/the//g;
$search =~ s/ /+/g;

print qq|

<html>
<head>
<title>$title</title>|;

print qq|
</head>
<body bgcolor="#ffffff">
<form method=GET name="searchform">
<input name="search" value="$search" type=TEXT size=15 maxlength=80>
&nbsp;
<input type="submit" value="submit" name="submit">
</form>

|;


$url =
"/cgi-bin/dbman/db.cgi?db=default&uid=default&JournalName=$search&view_records=1";

$html = get $url;

print qq| $html |;

print qq|</body></html>|;

sub Parse_Form {
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
@pairs = split(/&/, $ENV{'QUERY_STRING'});
} elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);

if ($ENV{'QUERY_STRING'}) {
@getpairs =split(/&/, $ENV{'QUERY_STRING'});
push(@pairs,@getpairs);
}
} else {
print "Content-type: text/html\n\n";
print "<P>Use Post or Get";
}

foreach $pair (@pairs) {
($key, $value) = split (/=/, $pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

$value =~s/<!--(.|\n)*-->//g;

if ($formdata{$key}) {
$formdata{$key} .= ", $value";
} else {
$formdata{$key} = $value;
}
}
}
1;

Last edited by:

sigrid: Jul 31, 2002, 11:50 AM

Edit Log: