version 1.265, 2006/05/30 12:46:09
|
version 1.269, 2006/06/13 14:42:24
|
Line 155 sub handler {
|
Line 155 sub handler {
|
## |
## |
my $domain = $r->dir_config('lonDefDomain'); |
my $domain = $r->dir_config('lonDefDomain'); |
$diropendb= "/home/httpd/perl/tmp/". |
$diropendb= "/home/httpd/perl/tmp/". |
"$env{'user.domain'}_$env{'user.name'}_searchcat.db"; |
"$env{'user.domain'}_$env{'user.name'}_sel_res.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 215 sub handler {
|
Line 215 sub handler {
|
untie %groupsearch_db if (tied(%groupsearch_db)); |
untie %groupsearch_db if (tied(%groupsearch_db)); |
if (($env{'form.cleargroupsort'} eq '1') || |
if (($env{'form.cleargroupsort'} eq '1') || |
(($env{'form.launch'} eq '1') && |
(($env{'form.launch'} eq '1') && |
($env{'form.catalogmode'} eq 'groupsearch'))) { |
($env{'form.catalogmode'} eq 'import'))) { |
if (tie(%groupsearch_db,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) { |
if (tie(%groupsearch_db,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) { |
&start_fresh_session(); |
&start_fresh_session(); |
untie %groupsearch_db; |
untie %groupsearch_db; |
Line 260 sub handler {
|
Line 260 sub handler {
|
$closebutton .="onClick='self.close()'"; |
$closebutton .="onClick='self.close()'"; |
} |
} |
$closebutton .=">\n"; |
$closebutton .=">\n"; |
} elsif ($env{'form.catalogmode'} eq 'groupsearch') { |
} elsif ($env{'form.catalogmode'} eq 'import') { |
$closebutton="<input type='button' name='close' value='CLOSE' "; |
$closebutton="<input type='button' name='close' value='CLOSE' "; |
if ($env{'form.phase'} =~ /(results|run_search)/) { |
if ($env{'form.phase'} =~ /(results|run_search)/) { |
$closebutton .="onClick='parent.close()'"; |
$closebutton .="onClick='parent.close()'"; |
Line 660 Prints the form for the basic search. S
|
Line 660 Prints the form for the basic search. S
|
###################################################################### |
###################################################################### |
sub print_basic_search_form { |
sub print_basic_search_form { |
my ($r,$closebutton,$hidden_fields) = @_; |
my ($r,$closebutton,$hidden_fields) = @_; |
my $result = ($env{'form.catalogmode'} ne 'groupsearch'); |
my $result = ($env{'form.catalogmode'} ne 'import'); |
my $bread_crumb = |
my $bread_crumb = |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic', |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic', |
$env{'form.catalogmode'} ne 'groupsearch'); |
$env{'form.catalogmode'} ne 'import'); |
my $scrout = &Apache::loncommon::start_page('Search').$bread_crumb; |
my $scrout = &Apache::loncommon::start_page('Search').$bread_crumb; |
if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) { |
if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) { |
# Define interface components |
# Define interface components |
Line 794 sub print_advanced_search_form{
|
Line 794 sub print_advanced_search_form{
|
my ($r,$closebutton,$hidden_fields) = @_; |
my ($r,$closebutton,$hidden_fields) = @_; |
my $bread_crumb = |
my $bread_crumb = |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Advanced', |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Advanced', |
$env{'form.catalogmode'} ne 'groupsearch'); |
$env{'form.catalogmode'} ne 'import'); |
my %lt=&Apache::lonlocal::texthash('srch' => 'Search', |
my %lt=&Apache::lonlocal::texthash('srch' => 'Search', |
'reset' => 'Reset', |
'reset' => 'Reset', |
'help' => 'Help'); |
'help' => 'Help'); |
Line 2107 END
|
Line 2107 END
|
{'only_body' => 1}); |
{'only_body' => 1}); |
my $breadcrumbs= |
my $breadcrumbs= |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', |
$env{'form.catalogmode'} ne 'groupsearch'); |
$env{'form.catalogmode'} ne 'import'); |
|
|
my $result = <<END; |
my $result = <<END; |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
<form name="statusform" action="" method="POST"> |
<form name="statusform" action="" method="post" target="_top"> |
|
<input type="hidden" name="catalogmode" value="import" /> |
<input type="hidden" name="Queue" value="" /> |
<input type="hidden" name="Queue" value="" /> |
END |
END |
|
|
Line 2337 sub run_search {
|
Line 2338 sub run_search {
|
{'only_body' => 1}); |
{'only_body' => 1}); |
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', |
$env{'form.catalogmode'} ne 'groupsearch'); |
$env{'form.catalogmode'} ne 'import'); |
$r->print(<<END); |
$r->print(<<END); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
Line 2527 END
|
Line 2528 END
|
# results to get, so let the client know the top frame needs to be |
# results to get, so let the client know the top frame needs to be |
# loaded from /adm/searchcat |
# loaded from /adm/searchcat |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
# if ($env{'form.catalogmode'} ne 'groupsearch') { |
# if ($env{'form.catalogmode'} ne 'import') { |
$r->print("<script>". |
$r->print("<script>". |
"window.location='/adm/searchcat?". |
"window.location='/adm/searchcat?". |
"phase=sort&". |
"phase=sort&". |
Line 2594 sub display_results {
|
Line 2595 sub display_results {
|
} |
} |
## |
## |
## $checkbox_num is a count of the number of checkboxes output on the |
## $checkbox_num is a count of the number of checkboxes output on the |
## page this is used only during catalogmode=groupsearch. |
## page this is used only during catalogmode=import. |
my $checkbox_num = 0; |
my $checkbox_num = 0; |
## |
## |
## Get the catalog controls setup |
## Get the catalog controls setup |
## |
## |
my $action = "/adm/searchcat?phase=results"; |
my $action = "/adm/searchcat?phase=results"; |
## |
## |
## Deal with groupsearch by opening the groupsearch db file. |
## Deal with import by opening the import db file. |
if ($env{'form.catalogmode'} eq 'groupsearch') { |
if ($env{'form.catalogmode'} eq 'import') { |
if (! tie(%groupsearch_db,'GDBM_File',$diropendb, |
if (! tie(%groupsearch_db,'GDBM_File',$diropendb, |
&GDBM_WRCREAT(),0640)) { |
&GDBM_WRCREAT(),0640)) { |
$r->print('Unable to store import results.</form>'. |
$r->print('Unable to store import results.</form>'. |
Line 2825 onClick="javascript:select_data('$title'
|
Line 2826 onClick="javascript:select_data('$title'
|
</font> |
</font> |
END |
END |
} |
} |
} elsif ($env{'form.catalogmode'} eq 'groupsearch') { |
} elsif ($env{'form.catalogmode'} eq 'import') { |
$groupsearch_db{"pre_${fnum}_link"}=$url; |
$groupsearch_db{"pre_${fnum}_link"}=$url; |
$groupsearch_db{"pre_${fnum}_title"}=$title; |
$groupsearch_db{"pre_${fnum}_title"}=$title; |
$output.=<<END; |
$output.=<<END; |
Line 2964 The following environment variables are
|
Line 2965 The following environment variables are
|
|
|
=item 'form.catalogmode' |
=item 'form.catalogmode' |
|
|
Checked for 'interactive' and 'groupsearch'. |
Checked for 'interactive' and 'import'. |
|
|
=item 'form.mode' |
=item 'form.mode' |
|
|
Line 3056 function changeURL(val) {
|
Line 3057 function changeURL(val) {
|
SCRIPT |
SCRIPT |
} |
} |
} |
} |
$js.=<<SCRIPT if $env{'form.catalogmode'} eq 'groupsearch'; |
$js.=<<SCRIPT if $env{'form.catalogmode'} eq 'import'; |
<script type="text/javascript"> |
<script type="text/javascript"> |
function queue(checkbox_num,val) { |
function queue(checkbox_num,val) { |
if (document.forms.results.returnvalues.length != "undefined" && |
if (document.forms.results.returnvalues.length != "undefined" && |
Line 3076 SCRIPT
|
Line 3077 SCRIPT
|
} |
} |
function select_group() { |
function select_group() { |
parent.window.location= |
parent.window.location= |
"/adm/groupsort?mode=$env{'form.mode'}&catalogmode=groupsearch&acts="+ |
"/adm/groupsort?mode=$env{'form.mode'}&catalogmode=import&acts="+ |
parent.statusframe.document.forms.statusform.elements.Queue.value; |
parent.statusframe.document.forms.statusform.elements.Queue.value; |
} |
} |
</script> |
</script> |
Line 3086 SCRIPT
|
Line 3087 SCRIPT
|
{'only_body' =>1}); |
{'only_body' =>1}); |
my $result=<<END; |
my $result=<<END; |
$start_page |
$start_page |
<form name="results" method="post" action="/adm/searchcat" > |
<form name="results" method="post" action="/adm/searchcat"> |
<input type="hidden" name="Queue" value="" /> |
|
$importbutton |
$importbutton |
END |
END |
return $result; |
return $result; |
Line 3211 sub detailed_citation_view {
|
Line 3211 sub detailed_citation_view {
|
my $jumpurl=$values{'url'}; |
my $jumpurl=$values{'url'}; |
$jumpurl=~s/^\/ext\//http\:\/\//; |
$jumpurl=~s/^\/ext\//http\:\/\//; |
$result .= '<b>'.$prefix. |
$result .= '<b>'.$prefix. |
'<img src="'.&Apache::loncommon::icon($values{'url'}).' " />'.' '. |
'<img src="'.&Apache::loncommon::icon($values{'url'}).'" />'.' '. |
'<a href="'.$jumpurl.'" '. |
'<a href="'.$jumpurl.'" '. |
'target="search_preview">'.$values{'title'}."</a></b>\n"; |
'target="search_preview">'.$values{'title'}."</a></b>\n"; |
$result .= "<p>\n"; |
$result .= "<p>\n"; |
Line 3277 sub detailed_citation_view {
|
Line 3277 sub detailed_citation_view {
|
next if (! exists($values{$field->{'name'}}) || |
next if (! exists($values{$field->{'name'}}) || |
$values{$field->{'name'}} eq ''); |
$values{$field->{'name'}} eq ''); |
if (exists($field->{'type'}) && $field->{'type'} eq 'list') { |
if (exists($field->{'type'}) && $field->{'type'} eq 'list') { |
$result .= '<b>'.&mt($field->{'translate'}).'</b><ul>'; |
$result .= '<b>'.&mt($field->{'translate'}).'</b>'; |
foreach my $item (split(',',$values{$field->{'name'}})){ |
foreach my $item (split(',',$values{$field->{'name'}})){ |
$result .= '<li>'. |
$result .= |
'<a target="search_preview" '. |
&Apache::lonhtmlcommon::crumbs($item, |
'href="'.$jumpurl.'">'.$item.'</a></li>'; |
(($env{'form.catalogmode'} eq 'import')?'_top':'preview'), |
|
'/res', |
|
(($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),2,0,1); |
} |
} |
$result .= '</ul>'; |
|
} elsif (exists($field->{'format'}) && $field->{'format'} ne ''){ |
} elsif (exists($field->{'format'}) && $field->{'format'} ne ''){ |
$result.= &mt($field->{'translate'}, |
$result.= &mt($field->{'translate'}, |
sprintf($field->{'format'}, |
sprintf($field->{'format'}, |
$values{$field->{'name'}}))."<br />\n"; |
$values{$field->{'name'}}))."<br />\n"; |
} else { |
} else { |
if ($field->{'special'} eq 'url link') { |
if ($field->{'special'} eq 'url link') { |
$result.= |
$result.= |
&mt($field->{'translate'}, |
&Apache::lonhtmlcommon::crumbs($jumpurl, |
'<a href="'.$jumpurl.'" '. |
(($env{'form.catalogmode'} eq 'import')?'_top':'preview'), |
'target="search_preview">'. |
'', |
$values{$field->{'name'}}. |
(($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),3,0,1); |
'</a>'); |
|
} else { |
} else { |
$result.= &mt($field->{'translate'}, |
$result.= &mt($field->{'translate'}, |
$values{$field->{'name'}}); |
$values{$field->{'name'}}); |
Line 3352 sub summary_view {
|
Line 3352 sub summary_view {
|
} |
} |
my $jumpurl=$values{'url'}; |
my $jumpurl=$values{'url'}; |
$jumpurl=~s/^\/ext\//http\:\/\//; |
$jumpurl=~s/^\/ext\//http\:\/\//; |
|
my $link=&Apache::lonhtmlcommon::crumbs($jumpurl, |
|
(($env{'form.catalogmode'} eq 'import')?'_top':'preview'), |
|
'', |
|
(($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),2,0,1); |
|
|
$result.=<<END; |
$result.=<<END; |
<a href="$jumpurl" |
<a href="$jumpurl" |
target='search_preview'>$values{'title'}</a><br /> |
target='search_preview'>$values{'title'}</a>$link |
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br /> |
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br /> |
$values{'copyrighttag'}<br /> |
$values{'copyrighttag'}<br /> |
$values{'extrashow'} |
$values{'extrashow'} |
Line 3389 sub compact_view {
|
Line 3393 sub compact_view {
|
my ($prefix,%values) = @_; |
my ($prefix,%values) = @_; |
my $jumpurl=$values{'url'}; |
my $jumpurl=$values{'url'}; |
$jumpurl=~s/^\/ext\//http\:\/\//; |
$jumpurl=~s/^\/ext\//http\:\/\//; |
|
my $link=&Apache::lonhtmlcommon::crumbs($jumpurl, |
|
(($env{'form.catalogmode'} eq 'import')?'_top':'preview'), |
|
'', |
|
(($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),1,1,1).' '; |
my $result = |
my $result = |
$prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'">'; |
$prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'">'; |
if (exists($env{'form.sortfield'}) && |
if (exists($env{'form.sortfield'}) && |
Line 3399 sub compact_view {
|
Line 3406 sub compact_view {
|
$result .= ' '.$tmp.' '; |
$result .= ' '.$tmp.' '; |
} |
} |
$result.=' <a href="'.$jumpurl.'" target="search_preview">'. |
$result.=' <a href="'.$jumpurl.'" target="search_preview">'. |
$values{'title'}.'</a>'.(' 'x2). |
$values{'title'}.'</a>'.(' 'x2).$link. |
'<b>'.$values{'author'}.'</b> ('.$values{'domain'}.')<br />'; |
'<b>'.$values{'author'}.'</b> ('.$values{'domain'}.')<br />'; |
return $result; |
return $result; |
} |
} |