version 1.243, 2005/04/07 06:56:23
|
version 1.248, 2005/11/29 20:25:44
|
Line 283 END
|
Line 283 END
|
## Sanity checks on form elements |
## Sanity checks on form elements |
## |
## |
if (!defined($env{'form.viewselect'})) { |
if (!defined($env{'form.viewselect'})) { |
if (($env{'form.catalogmode'} eq 'groupsearch') || |
$env{'form.viewselect'} ="summary"; |
($env{'form.catalogmode'} eq 'interactive')) { |
|
$env{'form.viewselect'} ="Compact View"; |
|
} else { |
|
$env{'form.viewselect'} ="Detailed Citation View"; |
|
} |
|
} |
} |
$env{'form.phase'} = 'disp_basic' if (! exists($env{'form.phase'})); |
$env{'form.phase'} = 'disp_basic' if (! exists($env{'form.phase'})); |
$env{'form.show'} = 20 if (! exists($env{'form.show'})); |
$env{'form.show'} = 20 if (! exists($env{'form.show'})); |
Line 708 sub print_basic_search_form {
|
Line 703 sub print_basic_search_form {
|
), |
), |
$r->dir_config('lonDefDomain') |
$r->dir_config('lonDefDomain') |
).'</label>'; |
).'</label>'; |
|
my $inclext= '<label>'. |
|
&mt('[_1] include external resources', |
|
&Apache::lonhtmlcommon::checkbox |
|
('inclext',$env{'form.inclext'})).'</label>'; |
my $adv_search_link = |
my $adv_search_link = |
'<a href="/adm/searchcat?'. |
'<a href="/adm/searchcat?'. |
'phase=disp_adv&'. |
'phase=disp_adv&'. |
Line 740 sub print_basic_search_form {
|
Line 739 sub print_basic_search_form {
|
'<nobr>'.(' 'x3).$adv_search_link.'</nobr>'.'<br />'. |
'<nobr>'.(' 'x3).$adv_search_link.'</nobr>'.'<br />'. |
'<nobr>'.(' 'x1).$userelatedwords.'</nobr>'.'<br />'. |
'<nobr>'.(' 'x1).$userelatedwords.'</nobr>'.'<br />'. |
'<nobr>'.(' 'x1).$onlysearchdomain.'</nobr>'.'<br />'. |
'<nobr>'.(' 'x1).$onlysearchdomain.'</nobr>'.'<br />'. |
'</font></td>'. |
'<nobr>'.(' 'x1).$inclext.'</nobr>'.'<br />'. |
|
'</font></td>'. |
'</tr>'.$/; |
'</tr>'.$/; |
# |
# |
$scrout .= '<tr><td align="center" colspan="2">'. |
$scrout .= '<tr><td align="center" colspan="2">'. |
Line 860 ENDHEADER
|
Line 860 ENDHEADER
|
'abstract' => 1, |
'abstract' => 1, |
'standards'=> 1, |
'standards'=> 1, |
'mime' => 1, |
'mime' => 1, |
|
'subject' => 1, |
); |
); |
# |
# |
foreach my $field ('title','author','owner','authorspace','modifyinguser', |
foreach my $field ('title','author','subject','owner','authorspace', |
'keywords','notes','abstract','standards','mime') { |
'modifyinguser','keywords','notes','abstract', |
|
'standards','mime') { |
$scrout.='<tr><td align="right">'.&titlefield($fields{$field}).'</td><td>'. |
$scrout.='<tr><td align="right">'.&titlefield($fields{$field}).'</td><td>'. |
&Apache::lonmeta::prettyinput($field, |
&Apache::lonmeta::prettyinput($field, |
$env{'form.'.$field}, |
$env{'form.'.$field}, |
Line 900 ENDHEADER
|
Line 902 ENDHEADER
|
&titlefield(&mt('Domains')).'</td><td colspan="2">'. |
&titlefield(&mt('Domains')).'</td><td colspan="2">'. |
&Apache::loncommon::domain_select('domains', |
&Apache::loncommon::domain_select('domains', |
$env{'form.domains'},1). |
$env{'form.domains'},1). |
'</td></tr>'.$/; |
'<br /><label>'. |
|
&mt('[_1] include external resources', |
|
&Apache::lonhtmlcommon::checkbox |
|
('inclext',$env{'form.inclext'})).'</label></td></tr>'.$/; |
# |
# |
# Misc metadata |
# Misc metadata |
$scrout.='<tr><td align="right" valign="top">'. |
$scrout.='<tr><td align="right" valign="top">'. |
Line 1557 sub parse_domain_restrictions {
|
Line 1562 sub parse_domain_restrictions {
|
if (! exists($env{'form.domains'}) || $env{'form.domains'} eq '') { |
if (! exists($env{'form.domains'}) || $env{'form.domains'} eq '') { |
return (undef,'',undef); |
return (undef,'',undef); |
} |
} |
my @allowed_domains; |
my @allowed_domains = &Apache::loncommon::get_env_multiple('form.domains'); |
if (ref($env{'form.domains'})) { |
|
@allowed_domains = @{$env{'form.domains'}}; |
|
} else { |
|
@allowed_domains = ($env{'form.domains'}); |
|
} |
|
# |
# |
my %domain_hash = (); |
my %domain_hash = (); |
my $pretty_domains_string; |
my $pretty_domains_string; |
Line 2525 END
|
Line 2525 END
|
my %Fields = &parse_raw_result($result,$server); |
my %Fields = &parse_raw_result($result,$server); |
$Fields{'hostname'} = $server; |
$Fields{'hostname'} = $server; |
# |
# |
|
# Skip if external and we did not want that |
|
next if ((! $env{'form.inclext'}) && ($Fields{'url'}=~/^\/ext\//)); |
# Skip based on copyright |
# Skip based on copyright |
next if (! ©right_check(\%Fields)); |
next if (! ©right_check(\%Fields)); |
|
|
# |
# |
# Store the result in the mysql database |
# Store the result in the mysql database |
my $result = &Apache::lonmysql::store_row($table,\%Fields); |
my $result = &Apache::lonmysql::store_row($table,\%Fields); |
Line 2685 sub display_results {
|
Line 2688 sub display_results {
|
); |
); |
# |
# |
# Build sorting selector |
# Build sorting selector |
<<<<<<< lonsearchcat.pm |
|
my @field_order = ('default', |
|
'title', |
|
'author', |
|
'subject', |
|
'url', |
|
'keywords', |
|
'version', |
|
'language', |
|
'creationdate'=>, |
|
'lastrevisiondate', |
|
'owner', |
|
'copyright', |
|
'authorspace', |
|
'lowestgradeleve', |
|
'highestgradelevel', |
|
'standards', |
|
'count', |
|
'stdno', |
|
'avetries', |
|
'difficulty', |
|
'disc', |
|
'clear', |
|
'technical', |
|
'correct', |
|
'helpful', |
|
'depth', |
|
); |
|
my %sort_fields = ('default' => 'Default', |
|
'title' => 'Title', |
|
'author' => 'Author', |
|
'subject' => 'Subject', |
|
'url' => 'URL', |
|
'keywords' => 'Keywords', |
|
'version' => 'Version', |
|
'language' => 'Language', |
|
'creationdate'=> 'Creation Date', |
|
'lastrevisiondate' => 'Last Revision Date', |
|
'owner' => 'Owner', |
|
'copyright' => 'Copyright', |
|
'authorspace' => 'Authorspace', |
|
'lowestgradeleve' => 'Lowest Grade Level', |
|
'highestgradelevel' => 'Highest Grade Level', |
|
'standards' => 'Standards', |
|
'count' => 'Number of Accesses', |
|
'stdno' => 'Students Attempting', |
|
'avetries' => 'Average Number of Tries', |
|
'difficulty' => 'Mean Degree of Difficulty', |
|
'disc' => 'Mean Degree of Discrimination', |
|
'clear' => 'Evaluation: Clear', |
|
'technical' => 'Evaluation: Technically Correct', |
|
'correct' => 'Evaluation: Material is Correct', |
|
'helpful' => 'Evaluation: Material is Helpful', |
|
'depth' => 'Evaluation: Material has Depth', |
|
'select_form_order' => \@field_order, |
|
); |
|
|
|
my $sortform = &mt('Sort by [_1]', |
|
&Apache::loncommon::select_form($env{'form.sortfield'}, |
|
======= |
|
my @fields = |
my @fields = |
( |
( |
{key=>'default' }, |
{key=>'default' }, |
Line 2788 sub display_results {
|
Line 2731 sub display_results {
|
} |
} |
my %sort_fields = map {$_->{'key'},$_->{'desc'}} @fields; |
my %sort_fields = map {$_->{'key'},$_->{'desc'}} @fields; |
$sort_fields{'select_form_order'} = \@field_order; |
$sort_fields{'select_form_order'} = \@field_order; |
$ENV{'form.sortorder'} = 'asc' if (! exists($ENV{'form.sortorder'})); |
$env{'form.sortorder'} = 'desc' if (! exists($env{'form.sortorder'})); |
|
$env{'form.sortfield'} = 'count' if (! exists($env{'form.sortfield'})); |
|
if (! exists($env{'form.sortorder'})) { |
|
if ($env{'form.sortfield'}=~/^(count|stdno|disc|clear|technical|correct|helpful)$/) { |
|
$env{'form.sortorder'}='desc'; |
|
} else { |
|
$env{'form.sortorder'}='asc'; |
|
} |
|
} |
my $sortform = &mt('Sort by [_1] [_2]', |
my $sortform = &mt('Sort by [_1] [_2]', |
&Apache::loncommon::select_form($ENV{'form.sortfield'}, |
&Apache::loncommon::select_form($env{'form.sortfield'}, |
>>>>>>> 1.242 |
|
'sortfield', |
'sortfield', |
%sort_fields), |
%sort_fields), |
&Apache::loncommon::select_form($ENV{'form.sortorder'}, |
&Apache::loncommon::select_form($env{'form.sortorder'}, |
'sortorder', |
'sortorder', |
(asc =>&mt('Ascending'), |
(asc =>&mt('Ascending'), |
desc=>&mt('Descending') |
desc=>&mt('Descending') |
Line 2824 sub display_results {
|
Line 2774 sub display_results {
|
## |
## |
## Get results from MySQL table |
## Get results from MySQL table |
my $sort_command = 'id>='.$min.' AND id<='.$max; |
my $sort_command = 'id>='.$min.' AND id<='.$max; |
<<<<<<< lonsearchcat.pm |
|
if ($env{'form.sortfield'} ne 'default' && |
|
exists($sort_fields{$env{'form.sortfield'}})) { |
|
$sort_command = $env{'form.sortfield'}.' IS NOT NULL '. |
|
'ORDER BY '.$env{'form.sortfield'}. |
|
======= |
|
my $order; |
my $order; |
if (exists($ENV{'form.sortorder'})) { |
if (exists($env{'form.sortorder'})) { |
if ($ENV{'form.sortorder'} eq 'asc') { |
if ($env{'form.sortorder'} eq 'asc') { |
$order = 'ASC'; |
$order = 'ASC'; |
} elsif ($ENV{'form.sortorder'} eq 'desc') { |
} elsif ($env{'form.sortorder'} eq 'desc') { |
$order = 'DESC'; |
$order = 'DESC'; |
} else { |
} else { |
$order = ''; |
$order = ''; |
Line 2842 sub display_results {
|
Line 2786 sub display_results {
|
} else { |
} else { |
$order = ''; |
$order = ''; |
} |
} |
if ($ENV{'form.sortfield'} ne 'default' && |
if ($env{'form.sortfield'} ne 'default' && |
exists($sort_fields{$ENV{'form.sortfield'}})) { |
exists($sort_fields{$env{'form.sortfield'}})) { |
$sort_command = $ENV{'form.sortfield'}.' IS NOT NULL '. |
$sort_command = $env{'form.sortfield'}.' IS NOT NULL '. |
'ORDER BY '.$ENV{'form.sortfield'}.' '.$order. |
'ORDER BY '.$env{'form.sortfield'}.' '.$order. |
>>>>>>> 1.242 |
|
' LIMIT '.($min-1).','.($max-$min); |
' LIMIT '.($min-1).','.($max-$min); |
} |
} |
my @Results = &Apache::lonmysql::get_rows($table,$sort_command); |
my @Results = &Apache::lonmysql::get_rows($table,$sort_command); |
Line 3293 extra custom metadata to show.
|
Line 3236 extra custom metadata to show.
|
sub detailed_citation_view { |
sub detailed_citation_view { |
my ($prefix,%values) = @_; |
my ($prefix,%values) = @_; |
my $result; |
my $result; |
|
my $jumpurl=$values{'url'}; |
|
$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="http://'.$ENV{'HTTP_HOST'}.$values{'url'}.'" '. |
'<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"; |
$result .= '<b>'.$values{'author'}.'</b>,'. |
$result .= '<b>'.$values{'author'}.'</b>,'. |
Line 3364 sub detailed_citation_view {
|
Line 3309 sub detailed_citation_view {
|
foreach my $item (split(',',$values{$field->{'name'}})){ |
foreach my $item (split(',',$values{$field->{'name'}})){ |
$result .= '<li>'. |
$result .= '<li>'. |
'<a target="search_preview" '. |
'<a target="search_preview" '. |
'href="/res/'.$item.'">'.$item.'</a></li>'; |
'href="'.$jumpurl.'">'.$item.'</a></li>'; |
} |
} |
$result .= '</ul>'; |
$result .= '</ul>'; |
} elsif (exists($field->{'format'}) && $field->{'format'} ne ''){ |
} elsif (exists($field->{'format'}) && $field->{'format'} ne ''){ |
Line 3375 sub detailed_citation_view {
|
Line 3320 sub detailed_citation_view {
|
if ($field->{'special'} eq 'url link') { |
if ($field->{'special'} eq 'url link') { |
$result.= |
$result.= |
&mt($field->{'translate'}, |
&mt($field->{'translate'}, |
'<a href="'.$values{'url'}.'" '. |
'<a href="'.$jumpurl.'" '. |
'target="search_preview">'. |
'target="search_preview">'. |
$values{$field->{'name'}}. |
$values{$field->{'name'}}. |
'</a>'); |
'</a>'); |
Line 3411 sub summary_view {
|
Line 3356 sub summary_view {
|
my ($prefix,%values) = @_; |
my ($prefix,%values) = @_; |
my $icon=&Apache::loncommon::icon($values{'url'}); |
my $icon=&Apache::loncommon::icon($values{'url'}); |
my $result=qq{$prefix<img src="$icon" />}; |
my $result=qq{$prefix<img src="$icon" />}; |
if (exists($ENV{'form.sortfield'}) && |
if (exists($env{'form.sortfield'}) && |
$ENV{'form.sortfield'} !~ /^(default| |
$env{'form.sortfield'} !~ /^(default| |
author| |
author| |
url| |
url| |
title| |
title| |
owner| |
owner| |
lastrevisiondate| |
lastrevisiondate| |
copyright)$/x) { |
copyright)$/x) { |
my $tmp = $values{$ENV{'form.sortfield'}}; |
my $tmp = $values{$env{'form.sortfield'}}; |
if (! defined($tmp)) { $tmp = 'undefined'; } |
if (! defined($tmp)) { $tmp = 'undefined'; } |
$result .= ' '.$tmp.' '; |
$result .= ' '.$tmp.' '; |
} |
} |
|
my $jumpurl=$values{'url'}; |
|
$jumpurl=~s/^\/ext\//http\:\/\//; |
|
|
$result.=<<END; |
$result.=<<END; |
<a href="http://$ENV{'HTTP_HOST'}$values{'url'}" |
<a href="$jumpurl" |
target='search_preview'>$values{'title'}</a><br /> |
target='search_preview'>$values{'title'}</a><br /> |
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br /> |
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br /> |
$values{'copyrighttag'}<br /> |
$values{'copyrighttag'}<br /> |
Line 3448 END
|
Line 3396 END
|
###################################################################### |
###################################################################### |
sub compact_view { |
sub compact_view { |
my ($prefix,%values) = @_; |
my ($prefix,%values) = @_; |
|
my $jumpurl=$values{'url'}; |
|
$jumpurl=~s/^\/ext\//http\:\/\//; |
|
|
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'}) && |
$ENV{'form.sortfield'} !~ /^(default|author|url|title)$/) { |
$env{'form.sortfield'} !~ /^(default|author|url|title)$/) { |
my $tmp = $values{$ENV{'form.sortfield'}}; |
my $tmp = $values{$env{'form.sortfield'}}; |
if (! defined($tmp)) { $tmp = 'undefined'; } |
if (! defined($tmp)) { $tmp = 'undefined'; } |
$result .= ' '.$tmp.' '; |
$result .= ' '.$tmp.' '; |
} |
} |
$result.=' <a href="'.$values{'url'}.'" target="search_preview">'. |
$result.=' <a href="'.$jumpurl.'" target="search_preview">'. |
$values{'title'}.'</a>'.(' 'x2). |
$values{'title'}.'</a>'.(' 'x2). |
'<b>'.$values{'author'}.'</b><br />'; |
'<b>'.$values{'author'}.'</b> ('.$values{'domain'}.')<br />'; |
return $result; |
return $result; |
} |
} |
|
|
Line 3478 sub fielded_format_view {
|
Line 3429 sub fielded_format_view {
|
my ($prefix,%values) = @_; |
my ($prefix,%values) = @_; |
my $icon=&Apache::loncommon::icon($values{'url'}); |
my $icon=&Apache::loncommon::icon($values{'url'}); |
my %Translated = &Apache::lonmeta::fieldnames(); |
my %Translated = &Apache::lonmeta::fieldnames(); |
|
my $jumpurl=$values{'url'}; |
|
$jumpurl=~s/^\/ext\//http\:\/\//; |
|
|
my $result=<<END; |
my $result=<<END; |
$prefix <img src="$icon" /> |
$prefix <img src="$icon" /> |
<dl> |
<dl> |
<dt>URL:</dt> |
<dt>URL:</dt> |
<dd><a href="http://$ENV{'HTTP_HOST'}$values{'url'}" |
<dd><a href="$jumpurl" |
target='search_preview'>$values{'url'}</a></dd> |
target='search_preview'>$values{'url'}</a></dd> |
END |
END |
foreach my $field ('title','author','domain','subject','keywords','notes', |
foreach my $field ('title','author','domain','subject','keywords','notes', |