version 1.158, 2002/09/16 20:57:28
|
version 1.162, 2003/01/06 13:54:25
|
Line 439 ENDDOCUMENT
|
Line 439 ENDDOCUMENT
|
' '; |
' '; |
my $checkbox = &simplecheckbox('related',$ENV{'form.related'}); |
my $checkbox = &simplecheckbox('related',$ENV{'form.related'}); |
$scrout.=<<END; |
$scrout.=<<END; |
</td><td><a href="/adm/searchcat?phase=disp_adv">Advanced Search</a></td></tr> |
</td><td><a |
|
href="/adm/searchcat?phase=disp_adv&catalogmode=$ENV{'form.catalogmode'}&launch=$ENV{'form.launch'}" |
|
>Advanced Search</a></td></tr> |
<tr><td>$checkbox use related words</td><td></td></tr> |
<tr><td>$checkbox use related words</td><td></td></tr> |
</table> |
</table> |
</p> |
</p> |
Line 542 ENDHEADER
|
Line 544 ENDHEADER
|
$ENV{'form.abstract'}); |
$ENV{'form.abstract'}); |
# Hack - an empty table row. |
# Hack - an empty table row. |
$scrout.="<tr><td> </td><td> </td><td> </td></tr>\n"; |
$scrout.="<tr><td> </td><td> </td><td> </td></tr>\n"; |
$scrout.=&searchphrasefield('file<br />extension','mime', |
$scrout.=&searchphrasefield('file<br />extension','extension', |
$ENV{'form.mime'}); |
$ENV{'form.extension'}); |
$scrout.="<tr><td> </td><td> </td><td> </td></tr>\n"; |
$scrout.="<tr><td> </td><td> </td><td> </td></tr>\n"; |
$scrout.=&searchphrasefield('publisher<br />owner','owner', |
$scrout.=&searchphrasefield('publisher<br />owner','owner', |
$ENV{'form.owner'}); |
$ENV{'form.owner'}); |
$scrout.="</table>\n"; |
$scrout.="</table>\n"; |
$ENV{'form.category'}='any' unless length($ENV{'form.category'}); |
$ENV{'form.category'}='any' if (! defined($ENV{'form.category'})); |
$scrout.=&selectbox('File Category','category', |
$scrout.=&selectbox('File Category','category', |
$ENV{'form.category'}, |
$ENV{'form.category'}, |
'any','Any category', |
'any','Any category', |
Line 692 sub get_persistent_form_data {
|
Line 694 sub get_persistent_form_data {
|
&GDBM_READER(),0640)); |
&GDBM_READER(),0640)); |
# |
# |
# These make sure we do not get array references printed out as 'values'. |
# These make sure we do not get array references printed out as 'values'. |
my %arrays_allowed = ('form.category'=>1,'form.domains'=>1); |
my %arrays_allowed = ('form.domains'=>1); |
# |
# |
# Loop through the keys, looking for 'form.' |
# Loop through the keys, looking for 'form.' |
foreach my $name (keys(%persistent_db)) { |
foreach my $name (keys(%persistent_db)) { |
Line 1134 sub parse_advanced_search {
|
Line 1136 sub parse_advanced_search {
|
'lastrevisiondatestart_month','lastrevisiondatestart_day', |
'lastrevisiondatestart_month','lastrevisiondatestart_day', |
'lastrevisiondatestart_year','lastrevisiondateend_month', |
'lastrevisiondatestart_year','lastrevisiondateend_month', |
'lastrevisiondateend_day','lastrevisiondateend_year', |
'lastrevisiondateend_day','lastrevisiondateend_year', |
'notes','abstract','mime','language','owner', |
'notes','abstract','extension','language','owner', |
'custommetadata','customshow','category') { |
'custommetadata','customshow','category') { |
$ENV{"form.$field"}=~s/[^\w\/\s\(\)\=\-\"\']//g; |
$ENV{"form.$field"}=~s/[^\w\/\s\(\)\=\-\"\']//g; |
} |
} |
Line 1145 sub parse_advanced_search {
|
Line 1147 sub parse_advanced_search {
|
$ENV{"form.$_"}=~s/[^\w\/\s\(\)\=\-\"\']//g; |
$ENV{"form.$_"}=~s/[^\w\/\s\(\)\=\-\"\']//g; |
} |
} |
# Preprocess the category form element. |
# Preprocess the category form element. |
$ENV{'form.category'} = 'any' if (ref($ENV{'form.category'})); |
$ENV{'form.category'} = 'any' if (! defined($ENV{'form.category'}) || |
if ($ENV{'form.category'} ne 'any') { |
ref($ENV{'form.category'})); |
my @extensions = &Apache::loncommon::filecategorytypes |
# |
($ENV{'form.category'}); |
|
$ENV{'form.mime'} = join ' OR ',@extensions; |
|
} |
|
# Check to see if enough information was filled in |
# Check to see if enough information was filled in |
for my $field ('title','author','subject','keywords','url','version', |
for my $field ('title','author','subject','keywords','url','version', |
'notes','abstract','mime','language','owner', |
'notes','abstract','category','extension','language', |
'custommetadata') { |
'owner','custommetadata') { |
if (&filled($ENV{"form.$field"})) { |
if (&filled($ENV{"form.$field"})) { |
$fillflag++; |
$fillflag++; |
} |
} |
Line 1169 sub parse_advanced_search {
|
Line 1168 sub parse_advanced_search {
|
my $font = '<font color="#800000" face="helvetica">'; |
my $font = '<font color="#800000" face="helvetica">'; |
# Evaluate logical expression AND/OR/NOT phrase fields. |
# Evaluate logical expression AND/OR/NOT phrase fields. |
foreach my $field ('title','author','subject','notes','abstract','url', |
foreach my $field ('title','author','subject','notes','abstract','url', |
'keywords','version','owner','mime') { |
'keywords','version','owner') { |
if ($ENV{'form.'.$field}) { |
if ($ENV{'form.'.$field}) { |
my $searchphrase = $ENV{'form.'.$field}; |
my $searchphrase = $ENV{'form.'.$field}; |
$pretty_search_string .= $font."$field</font> contains <b>". |
$pretty_search_string .= $font."$field</font> contains <b>". |
Line 1188 sub parse_advanced_search {
|
Line 1187 sub parse_advanced_search {
|
push @queries,&build_SQL_query($field,$searchphrase); |
push @queries,&build_SQL_query($field,$searchphrase); |
} |
} |
} |
} |
# I dislike the hack below. |
# |
if ($ENV{'form.category'}) { |
# Make the 'mime' from 'form.category' and 'form.extension' |
$ENV{'form.mime'}=''; |
# |
|
my $searchphrase; |
|
if (exists($ENV{'form.category'}) && |
|
$ENV{'form.category'} !~ /^\s*$/ && |
|
$ENV{'form.category'} ne 'any') { |
|
my @extensions = &Apache::loncommon::filecategorytypes |
|
($ENV{'form.category'}); |
|
if (scalar(@extensions) > 0) { |
|
$searchphrase = join(' OR ',@extensions); |
|
} |
} |
} |
|
if (exists($ENV{'form.extension'}) && $ENV{'form.extension'} !~ /^\s*$/) { |
|
$searchphrase .= ' OR ' if (defined($searchphrase)); |
|
my @extensions = split(/,/,$ENV{'form.extension'}); |
|
$searchphrase .= join(' OR ',@extensions); |
|
} |
|
if (defined($searchphrase)) { |
|
push @queries,&build_SQL_query('mime',$searchphrase); |
|
$pretty_search_string .=$font.'mime</font> contains <b>'. |
|
$searchphrase.'</b><br />'; |
|
} |
|
##### |
# Evaluate option lists |
# Evaluate option lists |
if ($ENV{'form.language'} and $ENV{'form.language'} ne 'any') { |
if ($ENV{'form.language'} and $ENV{'form.language'} ne 'any') { |
push @queries,"(language like \"$ENV{'form.language'}\")"; |
push @queries,"(language like \"$ENV{'form.language'}\")"; |
Line 1976 END
|
Line 1995 END
|
my $time_remaining = $max_time - (time - $starttime) ; |
my $time_remaining = $max_time - (time - $starttime) ; |
my $last_time = $time_remaining; |
my $last_time = $time_remaining; |
&update_seconds($r,$time_remaining); |
&update_seconds($r,$time_remaining); |
while (($time_remaining > 0) && |
while (($time_remaining > 0) && |
((@Servers_to_contact) || keys(%Server_status))) { |
((@Servers_to_contact) || keys(%Server_status))) { |
# Send out a search request if it needs to be done. |
# Send out a search request if it needs to be done. |
if (@Servers_to_contact) { |
if (@Servers_to_contact) { |
Line 1994 END
|
Line 2013 END
|
# left to contact. |
# left to contact. |
sleep(1); |
sleep(1); |
} |
} |
&update_status($r,'waiting on '.(join(' ',keys(%Server_status)))); |
# |
|
if (scalar (keys(%Server_status))) { |
|
&update_status($r,'waiting on '.(join(' ',keys(%Server_status)))); |
|
} |
|
# |
|
# Loop through the servers we have contacted but do not |
|
# have results from yet, looking for results. |
while (my ($server,$status) = each(%Server_status)) { |
while (my ($server,$status) = each(%Server_status)) { |
last if ($connection->aborted()); |
last if ($connection->aborted()); |
if ($status eq 'con_lost') { |
if ($status eq 'con_lost') { |
Line 2057 END
|
Line 2082 END
|
} |
} |
last if ($connection->aborted()); |
last if ($connection->aborted()); |
# Finished looping through the servers |
# Finished looping through the servers |
|
$starttime = time if (@Servers_to_contact); |
$time_remaining = $max_time - (time - $starttime) ; |
$time_remaining = $max_time - (time - $starttime) ; |
if ($last_time - $time_remaining > 0) { |
if ($last_time - $time_remaining > 0) { |
$last_time = $time_remaining; |
$last_time = $time_remaining; |
Line 2224 sub display_results {
|
Line 2250 sub display_results {
|
## |
## |
foreach my $row (@Results) { |
foreach my $row (@Results) { |
if ($connection->aborted()) { |
if ($connection->aborted()) { |
untie %groupsearch_db if (tied(%groupsearch_db)); |
&cleanup(); |
&Apache::lonmysql::disconnect_from_db(); |
|
return; |
return; |
} |
} |
my %Fields = %{&parse_row(@$row)}; |
my %Fields = %{&parse_row(@$row)}; |
Line 2937 sub start_fresh_session {
|
Line 2962 sub start_fresh_session {
|
|
|
1; |
1; |
|
|
|
sub cleanup { |
|
untie %groupsearch_db if (tied(%groupsearch_db)); |
|
&Apache::lonmysql::disconnect_from_db(); |
|
} |
|
|
__END__ |
__END__ |
|
|
=pod |
=pod |