version 1.211, 2004/04/19 17:44:47
|
version 1.213, 2004/04/21 15:48:34
|
Line 74 use Apache::lonmeta;
|
Line 74 use Apache::lonmeta;
|
use Apache::lonhtmlcommon; |
use Apache::lonhtmlcommon; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use LONCAPA::lonmetadata(); |
use LONCAPA::lonmetadata(); |
|
use HTML::Entities(); |
|
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
Line 149 sub handler {
|
Line 150 sub handler {
|
## Initialize global variables |
## Initialize global variables |
## |
## |
my $domain = $r->dir_config('lonDefDomain'); |
my $domain = $r->dir_config('lonDefDomain'); |
$diropendb= "/home/httpd/perl/tmp/$ENV{'user.domain'}_$ENV{'user.name'}_searchcat.db"; |
$diropendb= "/home/httpd/perl/tmp/". |
|
"$ENV{'user.domain'}_$ENV{'user.name'}_searchcat.db"; |
# |
# |
# set the name of the persistent database |
# set the name of the persistent database |
# $ENV{'form.persistent_db_id'} can only have digits in it. |
# $ENV{'form.persistent_db_id'} can only have digits in it. |
Line 534 sub print_basic_search_form {
|
Line 536 sub print_basic_search_form {
|
undef,undef,! $ENV{'form.launch'}); |
undef,undef,! $ENV{'form.launch'}); |
my $scrout = &search_html_header().$bodytag; |
my $scrout = &search_html_header().$bodytag; |
if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) { |
if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) { |
my $Statement=&searchhelp(); |
# Define interface components |
$scrout.=(<<ENDDOCUMENT); |
my $userelatedwords= |
<form name="loncapa_search" method="post" action="/adm/searchcat"> |
&mt('[_1] use related words', |
<input type="hidden" name="phase" value="basic_search" /> |
&Apache::lonhtmlcommon::checkbox |
$hidden_fields |
('related',$ENV{'form.related'})); |
<p> |
my $onlysearchdomain= |
$Statement. |
&mt('[_1] only search domain [_2]', |
</p> |
&Apache::lonhtmlcommon::checkbox |
<p> |
('domains',$ENV{'form.domains'}), |
<table> |
$r->dir_config('lonDefDomain')); |
<tr><td> |
my $adv_search_link = |
ENDDOCUMENT |
'<a href="/adm/searchcat?'. |
$scrout.=' '. |
'phase=disp_adv&'. |
|
'catalogmode='.$ENV{'form.catalogmode'}. |
|
'&launch='.$ENV{'form.launch'}. |
|
'&mode='.$ENV{'form.mode'}. |
|
'">'.&mt('Advanced Search').'</a>'; |
|
# |
|
$scrout.='<form name="loncapa_search" method="post" '. |
|
'action="/adm/searchcat">'. |
|
'<input type="hidden" name="phase" value="basic_search" />'. |
|
$hidden_fields; |
|
# |
|
$scrout .= '<center>'.$/; |
|
if ($ENV{'request.course.id'}) { |
|
$scrout .= '<h1>'.&mt('LON-CAPA Catalog Search').'</h1>'; |
|
} else { |
|
# No need to tell them they are searching |
|
$scrout.= ('<br />'x2); |
|
} |
|
$scrout.='<table>'. |
|
'<tr><td align="center" valign="top">'. |
&Apache::lonhtmlcommon::textbox('basicexp', |
&Apache::lonhtmlcommon::textbox('basicexp', |
$ENV{'form.basicexp'},40). |
$ENV{'form.basicexp'},50).'<br />'. |
' '; |
'<font size="-1">'.&searchhelp().'</font>'.'</td>'. |
my $relatedcheckbox = |
'<td><font size="-1">'. |
&Apache::lonhtmlcommon::checkbox('related', |
'<nobr>'.(' 'x3).$adv_search_link.'</nobr>'.'<br />'. |
$ENV{'form.related'}); |
'<nobr>'.(' 'x1).$userelatedwords.'</nobr>'.'<br />'. |
my $domain = $r->dir_config('lonDefDomain'); |
'<nobr>'.(' 'x1).$onlysearchdomain.'</nobr>'.'<br />'. |
my $domaincheckbox = |
'</font></td>'. |
&Apache::lonhtmlcommon::checkbox('domains', |
'</tr>'.$/; |
$ENV{'form.domains'}); |
# |
my $srch=&mt('Search'); |
# $scrout .= '<tr><td align="center">'. |
my $header=&mt('Advanced Search'); |
# '<font size="-1">'. |
my $userelatedwords=&mt('use related words'); |
# $userelatedwords.(' 'x3). |
my $onlysearchdomain=&mt('only search domain'); |
# $onlysearchdomain.(' 'x2).$adv_search_link. |
my $view=&viewoptions(); |
# '</font>'. |
$scrout.=<<END; |
# '</td></tr>'.$/; |
</td><td><a |
$scrout .= '<tr><td align="center" colspan="2">'. |
href="/adm/searchcat?phase=disp_adv&catalogmode=$ENV{'form.catalogmode'}&launch=$ENV{'form.launch'}&mode=$ENV{'form.mode'}" |
'<font size="-1">'. |
>$header</a></td></tr> |
'<input type="submit" name="basicsubmit" '. |
<tr><td>$relatedcheckbox $userelatedwords</td> |
'value="'.&mt('Search').'" />'. |
<td>$domaincheckbox $onlysearchdomain <b>$domain</b></td></tr> |
(' 'x2).$closebutton.(' 'x2).&viewoptions(). |
</table> |
'</font>'. |
</p> |
'</td></tr>'.$/; |
$view |
$scrout .= '</table>'.$/.'</center>'.'</form>'; |
<p> |
|
<input type="submit" name="basicsubmit" value='$srch' /> |
|
$closebutton |
|
END |
|
$scrout.=<<ENDDOCUMENT; |
|
</p> |
|
</form> |
|
ENDDOCUMENT |
|
} |
} |
if ($ENV{'request.course.id'}) { |
if ($ENV{'request.course.id'}) { |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash('srch' => 'Search', |
'srch' => 'Search', |
|
'header' => 'Course Search', |
'header' => 'Course Search', |
'note' => 'Enter terms or phrases, then press "Search" below', |
'note' => 'Enter terms or phrases, then press "Search" below', |
'use' => 'use related words', |
'use' => 'use related words', |
'full' =>'fulltext search (time consuming)' |
'full' =>'fulltext search (time consuming)' |
); |
); |
$scrout.=(<<ENDCOURSESEARCH); |
$scrout.=(<<ENDCOURSESEARCH); |
|
<form name="loncapa_search" method="post" action="/adm/searchcat"> |
|
<center> |
<hr /> |
<hr /> |
<h1>$lt{'header'}</h1> |
<h1>$lt{'header'}</h1> |
<form name="course_search" method="post" action="/adm/searchcat"> |
|
<input type="hidden" name="phase" value="course_search" /> |
<input type="hidden" name="phase" value="course_search" /> |
$hidden_fields |
$hidden_fields |
<p> |
<p> |
Line 617 ENDCOURSESEARCH
|
Line 630 ENDCOURSESEARCH
|
</table><p> |
</table><p> |
<input type="submit" name="coursesubmit" value='$lt{'srch'}' /> |
<input type="submit" name="coursesubmit" value='$lt{'srch'}' /> |
</p> |
</p> |
|
</center> |
|
</form> |
ENDENDCOURSE |
ENDENDCOURSE |
} |
} |
$scrout.=(<<ENDDOCUMENT); |
$scrout.=(<<ENDDOCUMENT); |
Line 1061 sub parse_advanced_search {
|
Line 1076 sub parse_advanced_search {
|
$fillflag++; |
$fillflag++; |
} |
} |
} |
} |
unless ($fillflag) { |
if (! $fillflag) { |
&output_blank_field_error($r,$closebutton, |
&output_blank_field_error($r,$closebutton, |
'phase=disp_adv',$hidden_fields); |
'phase=disp_adv',$hidden_fields); |
return ; |
return ; |
Line 1717 Returns: the identifier of the table on
|
Line 1732 Returns: the identifier of the table on
|
sub set_up_table_structure { |
sub set_up_table_structure { |
my ($datatypes,$fullindicies) = |
my ($datatypes,$fullindicies) = |
&LONCAPA::lonmetadata::describe_metadata_storage(); |
&LONCAPA::lonmetadata::describe_metadata_storage(); |
unshift(@$datatypes,{name => 'id', |
# Copy the table description before modifying it... |
|
@Datatypes = @{$datatypes}; |
|
unshift(@Datatypes,{name => 'id', |
type => 'MEDIUMINT', |
type => 'MEDIUMINT', |
restrictions => 'UNSIGNED NOT NULL', |
restrictions => 'UNSIGNED NOT NULL', |
primary_key => 'yes', |
primary_key => 'yes', |
auto_inc => 'yes' }); |
auto_inc => 'yes' }); |
@Datatypes = @{$datatypes}; |
|
@Fullindicies = @{$fullindicies}; |
@Fullindicies = @{$fullindicies}; |
return; |
return; |
} |
} |
Line 1926 END
|
Line 1942 END
|
&update_status($r,'contacting '.$Servers_to_contact[0]); |
&update_status($r,'contacting '.$Servers_to_contact[0]); |
while (($time_remaining > 0) && |
while (($time_remaining > 0) && |
((@Servers_to_contact) || keys(%Server_status))) { |
((@Servers_to_contact) || keys(%Server_status))) { |
|
$time_remaining = $max_time - (time - $starttime) ; |
&update_seconds($r,$time_remaining); |
&update_seconds($r,$time_remaining); |
# 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 2201 sub display_results {
|
Line 2218 sub display_results {
|
} |
} |
my $prefix=&catalogmode_output($Fields{'title'},$Fields{'url'}, |
my $prefix=&catalogmode_output($Fields{'title'},$Fields{'url'}, |
$Fields{'id'},$checkbox_num++); |
$Fields{'id'},$checkbox_num++); |
|
|
# Render the result into html |
# Render the result into html |
$output.= &$viewfunction($prefix,%Fields); |
$output.= &$viewfunction($prefix,%Fields); |
# Print them out as they come in. |
# Print them out as they come in. |
Line 2716 END
|
Line 2734 END
|
###################################################################### |
###################################################################### |
sub xml_sgml_view { |
sub xml_sgml_view { |
my ($prefix,%values) = @_; |
my ($prefix,%values) = @_; |
|
my $xml = <<END; |
|
<LonCapaResource> |
|
<url>$values{'url'}</url> |
|
<title>$values{'title'}</title> |
|
<author>$values{'author'}</author> |
|
<subject>$values{'subject'}</subject> |
|
<keywords>$values{'keywords'}</keywords> |
|
<notes>$values{'notes'}</notes> |
|
<mimeInfo> |
|
<mime>$values{'mime'}</mime> |
|
<mimetag>$values{'mimetag'}</mimetag> |
|
</mimeInfo> |
|
<languageInfo> |
|
<language>$values{'language'}</language> |
|
<languagetag>$values{'languagetag'}</languagetag> |
|
</languageInfo> |
|
<creationdate>$values{'creationdate'}</creationdate> |
|
<lastrevisiondate>$values{'lastrevisiondate'}</lastrevisiondate> |
|
<owner>$values{'owner'}</owner> |
|
<copyrightInfo> |
|
<copyright>$values{'copyright'}</copyright> |
|
<copyrighttag>$values{'copyrighttag'}</copyrighttag> |
|
</copyrightInfo> |
|
<repositoryLocation>$values{'hostname'}</repositoryLocation> |
|
<shortabstract>$values{'shortabstract'}</shortabstract> |
|
</LonCapaResource> |
|
END |
|
$xml = &HTML::Entities::encode($xml,'<>&'); |
my $result=<<END; |
my $result=<<END; |
$prefix |
$prefix |
<pre> |
<pre> |
<LonCapaResource> |
$xml |
<url>$values{'url'}</url> |
|
<title>$values{'title'}</title> |
|
<author>$values{'author'}</author> |
|
<subject>$values{'subject'}</subject> |
|
<keywords>$values{'keywords'}</keywords> |
|
<notes>$values{'notes'}</notes> |
|
<mimeInfo> |
|
<mime>$values{'mime'}</mime> |
|
<mimetag>$values{'mimetag'}</mimetag> |
|
</mimeInfo> |
|
<languageInfo> |
|
<language>$values{'language'}</language> |
|
<languagetag>$values{'languagetag'}</languagetag> |
|
</languageInfo> |
|
<creationdate>$values{'creationdate'}</creationdate> |
|
<lastrevisiondate>$values{'lastrevisiondate'}</lastrevisiondate> |
|
<owner>$values{'owner'}</owner> |
|
<copyrightInfo> |
|
<copyright>$values{'copyright'}</copyright> |
|
<copyrighttag>$values{'copyrighttag'}</copyrighttag> |
|
</copyrightInfo> |
|
<repositoryLocation>$values{'hostname'}</repositoryLocation> |
|
<shortabstract>$values{'shortabstract'}</shortabstract> |
|
</LonCapaResource> |
|
</pre> |
</pre> |
$values{'extrashow'} |
$values{'extrashow'} |
<hr align='left' width='200' noshade /> |
<hr align='left' width='200' noshade /> |