version 1.68, 2001/03/22 13:40:07
|
version 1.84, 2001/03/27 19:05:02
|
Line 229 LASTREVISIONDATEEND
|
Line 229 LASTREVISIONDATEEND
|
# ------------------------------------------- Compute customized metadata field |
# ------------------------------------------- Compute customized metadata field |
$scrout.=<<CUSTOMMETADATA; |
$scrout.=<<CUSTOMMETADATA; |
<p> |
<p> |
<font color="#800000" face="helvetica"><b>LIMIT BY OTHER METADATA FIELDS:</b> |
<font color="#800000" face="helvetica"><b>LIMIT BY SPECIAL METADATA FIELDS:</b> |
</font> |
</font> |
For author-specific metadata, enter in an expression in the form of |
For resource-specific metadata, enter in an expression in the form of |
<i>key</i>=<i>value</i> separated by operators such as AND or OR.<br> |
<i>key</i>=<i>value</i> separated by operators such as AND or OR.<br> |
<b>Example:</b> grandmother=75 OR grandfather=85 |
<b>Example:</b> grandmother=75 OR grandfather=85 |
<br> |
<br> |
Line 239 CUSTOMMETADATA
|
Line 239 CUSTOMMETADATA
|
$scrout.=&simpletextfield('custommetadata',$ENV{'form.custommetadata'}); |
$scrout.=&simpletextfield('custommetadata',$ENV{'form.custommetadata'}); |
$scrout.=' <i>initial users of this system do not need to worry about this option</i>'; |
$scrout.=' <i>initial users of this system do not need to worry about this option</i>'; |
|
|
|
$scrout.=<<CUSTOMSHOW; |
|
<p> |
|
<font color="#800000" face="helvetica"><b>SHOW SPECIAL METADATA FIELDS:</b> |
|
</font> |
|
Enter in a space-separated list of special metadata fields to show |
|
in a fielded listing for each record result. |
|
<br> |
|
CUSTOMSHOW |
|
$scrout.=&simpletextfield('customshow',$ENV{'form.customshow'}); |
|
$scrout.=' <i>initial users of this system do not need to worry about this option</i>'; |
|
|
# ---------------------------------------------------------------- Print screen |
# ---------------------------------------------------------------- Print screen |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
<html> |
Line 487 sub advancedsearch {
|
Line 498 sub advancedsearch {
|
'lastrevisiondatestart_year','lastrevisiondateend_month', |
'lastrevisiondatestart_year','lastrevisiondateend_month', |
'lastrevisiondateend_day','lastrevisiondateend_year', |
'lastrevisiondateend_day','lastrevisiondateend_year', |
'notes','abstract','mime','language','owner', |
'notes','abstract','mime','language','owner', |
'custommetadata') { |
'custommetadata','customshow') { |
$ENV{"form.$field"}=~s/[^\w\s\(\)\=\-\"\']//g; |
$ENV{"form.$field"}=~s/[^\w\s\(\)\=\-\"\']//g; |
} |
} |
for my $field ('title','author','subject','keywords','url','version', |
for my $field ('title','author','subject','keywords','url','version', |
Line 544 sub advancedsearch {
|
Line 555 sub advancedsearch {
|
elsif ($datequery) { |
elsif ($datequery) { |
push @queries,$datequery; |
push @queries,$datequery; |
} |
} |
my $customquery; |
my $customquery=''; |
if ($ENV{'form.custommetadata'}) { |
if ($ENV{'form.custommetadata'}) { |
$customquery=&build_custommetadata_query('custommetadata', |
$customquery=&build_custommetadata_query('custommetadata', |
$ENV{'form.custommetadata'}); |
$ENV{'form.custommetadata'}); |
} |
} |
|
my $customshow=''; |
|
if ($ENV{'form.customshow'}) { |
|
$customshow=$ENV{'form.customshow'}; |
|
$customshow=~s/[^\w\s]//g; |
|
my @fields=split(/\s+/,$customshow); |
|
$customshow=join(" ",@fields); |
|
} |
if (@queries) { |
if (@queries) { |
$query=join(" AND ",@queries); |
$query=join(" AND ",@queries); |
$query="select * from metadata where $query"; |
$query="select * from metadata where $query"; |
my $reply=&Apache::lonnet::metadata_query($query); |
my $reply=''; |
|
unless ($customquery or $customshow) { |
|
$reply=&Apache::lonnet::metadata_query($query); |
|
} |
|
else { |
|
$reply=&Apache::lonnet::metadata_query($query, |
|
$customquery,$customshow); |
|
} |
&output_results('Advanced',$r,$envhash,$customquery,$reply); |
&output_results('Advanced',$r,$envhash,$customquery,$reply); |
} |
} |
else { |
else { |
&output_results('Advanced',$r,$envhash,$query); |
&output_results('Advanced',$r,$envhash,$query); |
} |
} |
|
$r->print(' '); |
return OK; |
return OK; |
} |
} |
|
|
Line 659 sub output_results {
|
Line 685 sub output_results {
|
@results=<$fh>; |
@results=<$fh>; |
} |
} |
|
|
|
my $customshow=''; |
|
my $extrashow=''; |
|
if ($ENV{'form.customshow'}) { |
|
$customshow=$ENV{'form.customshow'}; |
|
$customshow=~s/[^\w\s]//g; |
|
my @fields=map {"<font color=\"#008000\">$_:</font>"} |
|
split(/\s+/,$customshow); |
|
if ($customshow) { |
|
$extrashow="<ul><li>".join("</li><li>",@fields)."</li></ul>\n"; |
|
} |
|
} |
|
my $customdata=''; |
|
foreach my $result (@results) { |
|
if ($result=~/^(custom\=.*)$/) { # grab all custom metadata |
|
$customdata.=$result; |
|
} |
|
} |
foreach my $result (@results) { |
foreach my $result (@results) { |
|
next if $result=~/^custom\=/; |
|
chomp $result; |
my @fields=map |
my @fields=map |
{&Apache::lonnet::unescape($_)} |
{&Apache::lonnet::unescape($_)} |
(split(/\,/,$result)); |
(split(/\,/,$result)); |
Line 690 END
|
Line 735 END
|
|
|
if ($viewselect eq 'Detailed Citation View') { |
if ($viewselect eq 'Detailed Citation View') { |
$compiledresult.=&detailed_citation_view(@fields, |
$compiledresult.=&detailed_citation_view(@fields, |
$hostname,$httphost); |
$hostname,$httphost, |
|
$extrashow); |
} |
} |
elsif ($viewselect eq 'Summary View') { |
elsif ($viewselect eq 'Summary View') { |
$compiledresult.=&summary_view(@fields,$hostname,$httphost); |
$compiledresult.=&summary_view(@fields,$hostname,$httphost, |
|
$extrashow); |
} |
} |
elsif ($viewselect eq 'Fielded Format') { |
elsif ($viewselect eq 'Fielded Format') { |
$compiledresult.=&fielded_format_view(@fields,$hostname, |
$compiledresult.=&fielded_format_view(@fields,$hostname, |
$httphost); |
$httphost,$extrashow); |
} |
} |
elsif ($viewselect eq 'XML/SGML') { |
elsif ($viewselect eq 'XML/SGML') { |
$compiledresult.=&xml_sgml_view(@fields,$hostname,$httphost); |
$compiledresult.=&xml_sgml_view(@fields,$hostname,$httphost, |
|
$extrashow); |
} |
} |
|
|
} |
} |
Line 741 SCRIPT
|
Line 789 SCRIPT
|
<img align=right src=/adm/lonIcons/lonlogos.gif> |
<img align=right src=/adm/lonIcons/lonlogos.gif> |
<h1>Search Catalog</h1> |
<h1>Search Catalog</h1> |
<form method="post" action="/adm/searchcat"> |
<form method="post" action="/adm/searchcat"> |
|
$customdata |
<input type='button' value='Revise search request' |
<input type='button' value='Revise search request' |
onClick='this.form.submit();'> |
onClick='this.form.submit();'> |
$closebutton |
$closebutton |
Line 792 sub build_custommetadata_query {
|
Line 841 sub build_custommetadata_query {
|
-build => 'Text::Query::BuildAdvancedString'); |
-build => 'Text::Query::BuildAdvancedString'); |
$q->prepare($logic_statement); |
$q->prepare($logic_statement); |
my $matchexp=${$q}{'-parse'}{'-build'}{'matchstring'}; |
my $matchexp=${$q}{'-parse'}{'-build'}{'matchstring'}; |
|
# quick fix to change literal into xml tag-matching |
|
# will eventually have to write a separate builder module |
|
my $oldmatchexp=$matchexp; |
|
$matchexp=~s/(\w+)\\\=(\w+)/\\\<$1\\\>\[\^\\\<\]\*$2\[\^\\\<\]\*\\\<\\\/$1\\\>/g; |
return $matchexp; |
return $matchexp; |
} |
} |
|
|
Line 829 sub detailed_citation_view {
|
Line 882 sub detailed_citation_view {
|
my ($title,$author,$subject,$url,$keywords,$version, |
my ($title,$author,$subject,$url,$keywords,$version, |
$notes,$shortabstract,$mime,$lang, |
$notes,$shortabstract,$mime,$lang, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$hostname,$httphost)=@_; |
$hostname,$httphost,$extrashow)=@_; |
my $result=<<END; |
my $result=<<END; |
<i>$owner</i>, last revised $lastrevisiondate |
<i>$owner</i>, last revised $lastrevisiondate |
<h3><A HREF="http://$httphost$url" TARGET='search_preview'>$title</A></h3> |
<h3><A HREF="http://$httphost$url" TARGET='search_preview'>$title</A></h3> |
Line 842 sub detailed_citation_view {
|
Line 895 sub detailed_citation_view {
|
<b>MIME Type:</b> $mimetag{$mime}<br> |
<b>MIME Type:</b> $mimetag{$mime}<br> |
<b>Language:</b> $language{$lang}<br> |
<b>Language:</b> $language{$lang}<br> |
<b>Copyright/Distribution:</b> $cprtag{$copyright}<br> |
<b>Copyright/Distribution:</b> $cprtag{$copyright}<br> |
|
</p> |
|
$extrashow |
|
<p> |
$shortabstract |
$shortabstract |
</p> |
</p> |
END |
END |
Line 853 sub summary_view {
|
Line 909 sub summary_view {
|
my ($title,$author,$subject,$url,$keywords,$version, |
my ($title,$author,$subject,$url,$keywords,$version, |
$notes,$shortabstract,$mime,$lang, |
$notes,$shortabstract,$mime,$lang, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$hostname,$httphost)=@_; |
$hostname,$httphost,$extrashow)=@_; |
my $result=<<END; |
my $result=<<END; |
<a href="http://$httphost$url" TARGET='search_preview'>$author</a><br /> |
<a href="http://$httphost$url" TARGET='search_preview'>$author</a><br /> |
$title<br /> |
$title<br /> |
$owner -- $lastrevisiondate<br /> |
$owner -- $lastrevisiondate<br /> |
$cprtag{$copyright}<br /> |
$cprtag{$copyright}<br /> |
|
$extrashow |
</p> |
</p> |
END |
END |
return $result; |
return $result; |
Line 869 sub fielded_format_view {
|
Line 926 sub fielded_format_view {
|
my ($title,$author,$subject,$url,$keywords,$version, |
my ($title,$author,$subject,$url,$keywords,$version, |
$notes,$shortabstract,$mime,$lang, |
$notes,$shortabstract,$mime,$lang, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$hostname,$httphost)=@_; |
$hostname,$httphost,$extrashow)=@_; |
my $result=<<END; |
my $result=<<END; |
<b>URL: </b> <A HREF="http://$httphost$url" TARGET='search_preview'>$url</A> |
<b>URL: </b> <A HREF="http://$httphost$url" TARGET='search_preview'>$url</A> |
<br /> |
<br /> |
Line 886 sub fielded_format_view {
|
Line 943 sub fielded_format_view {
|
<b>Copyright/Distribution:</b> $cprtag{$copyright}<br /> |
<b>Copyright/Distribution:</b> $cprtag{$copyright}<br /> |
<b>Repository Location:</b> $hostname<br /> |
<b>Repository Location:</b> $hostname<br /> |
<b>Abstract:</b> $shortabstract<br /> |
<b>Abstract:</b> $shortabstract<br /> |
|
$extrashow |
</p> |
</p> |
END |
END |
return $result; |
return $result; |
Line 896 sub xml_sgml_view {
|
Line 954 sub xml_sgml_view {
|
my ($title,$author,$subject,$url,$keywords,$version, |
my ($title,$author,$subject,$url,$keywords,$version, |
$notes,$shortabstract,$mime,$lang, |
$notes,$shortabstract,$mime,$lang, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$creationdate,$lastrevisiondate,$owner,$copyright, |
$hostname,$httphost)=@_; |
$hostname,$httphost,$extrashow)=@_; |
my $result=<<END; |
my $result=<<END; |
<pre> |
<pre> |
<LonCapaResource> |
<LonCapaResource> |
Line 925 sub xml_sgml_view {
|
Line 983 sub xml_sgml_view {
|
<shortabstract>$shortabstract</shortabstract> |
<shortabstract>$shortabstract</shortabstract> |
</LonCapaResource> |
</LonCapaResource> |
</pre> |
</pre> |
|
$extrashow |
END |
END |
return $result; |
return $result; |
} |
} |
Line 1014 sub make_persistent {
|
Line 1073 sub make_persistent {
|
if (/^form\./ && !/submit/) { |
if (/^form\./ && !/submit/) { |
my $name=$_; |
my $name=$_; |
my $key=$name; |
my $key=$name; |
|
$ENV{$key}=~s/\'//g; # do not mess with html field syntax |
$name=~s/^form\.//; |
$name=~s/^form\.//; |
$persistent.=<<END; |
$persistent.=<<END; |
<input type='hidden' name='$name' value='$ENV{$key}' /> |
<input type='hidden' name='$name' value='$ENV{$key}' /> |