version 1.222, 2004/05/05 14:14:10
|
version 1.225, 2004/05/09 22:55:17
|
Line 231 END
|
Line 231 END
|
$hidden_fields = '<input type="hidden" name="persistent_db_id" value="'. |
$hidden_fields = '<input type="hidden" name="persistent_db_id" value="'. |
$ENV{'form.persistent_db_id'}.'" />'."\n"; |
$ENV{'form.persistent_db_id'}.'" />'."\n"; |
if (exists($ENV{'form.catalogmode'})) { |
if (exists($ENV{'form.catalogmode'})) { |
$hidden_fields .= '<input type="hidden" name="catalogmode" value="'. |
$hidden_fields .= &hidden_field('catalogmode'); |
$ENV{'form.catalogmode'}.'" />'."\n"; |
|
} |
} |
if (exists($ENV{'form.form'})) { |
if (exists($ENV{'form.form'})) { |
$hidden_fields .= '<input type="hidden" name="form" value="'. |
$hidden_fields .= &hidden_field('form'); |
$ENV{'form.form'}.'" />'."\n"; |
|
} |
} |
if (exists($ENV{'form.element'})) { |
if (exists($ENV{'form.element'})) { |
$hidden_fields .= '<input type="hidden" name="element" value="'. |
$hidden_fields .= &hidden_field('element'); |
$ENV{'form.element'}.'" />'."\n"; |
|
} |
} |
if (exists($ENV{'form.titleelement'})) { |
if (exists($ENV{'form.titleelement'})) { |
$hidden_fields .= '<input type="hidden" name="titleelement" value="'. |
$hidden_fields .= &hidden_field('titleelement'); |
$ENV{'form.titleelement'}.'" />'."\n"; |
|
} |
} |
if (exists($ENV{'form.mode'})) { |
if (exists($ENV{'form.mode'})) { |
$hidden_fields .= '<input type="hidden" name="mode" value="'. |
$hidden_fields .= &hidden_field('mode'); |
$ENV{'form.mode'}.'" />'."\n"; |
|
} |
} |
## |
## |
## Configure dynamic components of interface |
## Configure dynamic components of interface |
Line 422 sub clean_up_environment {
|
Line 417 sub clean_up_environment {
|
} |
} |
} |
} |
|
|
|
sub hidden_field { |
|
my ($name,$value) = @_; |
|
if (! defined($value)) { |
|
$value = $ENV{'form.'.$name}; |
|
} |
|
return '<input type="hidden" name="'.$name.'" value="'.$value.'" />'.$/; |
|
} |
|
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
## |
## |
Line 616 sub print_basic_search_form {
|
Line 619 sub print_basic_search_form {
|
'<font size="-1">'. |
'<font size="-1">'. |
'<input type="submit" name="basicsubmit" '. |
'<input type="submit" name="basicsubmit" '. |
'value="'.&mt('Search').'" />'. |
'value="'.&mt('Search').'" />'. |
(' 'x2).$closebutton.(' 'x2).&viewoptions(). |
(' 'x2).$closebutton.(' 'x2). |
|
&viewoptions(). |
'</font>'. |
'</font>'. |
'</td></tr>'.$/; |
'</td></tr>'.$/; |
$scrout .= '</table>'.$/.'</center>'.'</form>'; |
$scrout .= '</table>'.$/.'</center>'.'</form>'; |
Line 959 Outputs: text for box with view options
|
Line 963 Outputs: text for box with view options
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
sub viewoptions { |
sub viewoptions { |
my $scrout="\n".'<nobr>'; |
my $scrout; |
if (! defined($ENV{'form.viewselect'})) { |
if (! defined($ENV{'form.viewselect'})) { |
$ENV{'form.viewselect'}='detailed'; |
$ENV{'form.viewselect'}='detailed'; |
} |
} |
Line 1244 sub parse_advanced_search {
|
Line 1248 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 (@BasicFields) { |
foreach my $field (@BasicFields) { |
if ($ENV{'form.'.$field}) { |
next if (!defined($ENV{'form.'.$field}) || $ENV{'form.'.$field} eq ''); |
my $searchphrase = $ENV{'form.'.$field}; |
foreach my $searchphrase(&process_phrase_input($ENV{'form.'.$field})){ |
$pretty_search_string .= $font."$field</font> contains <b>". |
$pretty_search_string .= $font."$field</font> contains <b>". |
$searchphrase."</b>"; |
$searchphrase."</b>"; |
if ($ENV{'form.'.$field.'_related'}) { |
if ($ENV{'form.'.$field.'_related'}) { |
Line 1259 sub parse_advanced_search {
|
Line 1263 sub parse_advanced_search {
|
} |
} |
} |
} |
$pretty_search_string .= "<br />\n"; |
$pretty_search_string .= "<br />\n"; |
push @queries,&build_SQL_query($field,$searchphrase); |
push @queries,&build_SQL_query($field,$searchphrase); |
} |
} |
} |
} |
# |
# |
Line 1396 sub parse_advanced_search {
|
Line 1400 sub parse_advanced_search {
|
$pretty_search_string .= $pretty_domains_string."<br />\n"; |
$pretty_search_string .= $pretty_domains_string."<br />\n"; |
# |
# |
if (@queries) { |
if (@queries) { |
$query="select * from metadata where ".join(" AND ",@queries); |
$query="SELET * FROM metadata WHERE ".join(" AND ",@queries); |
} elsif ($customquery) { |
} elsif ($customquery) { |
$query = ''; |
$query = ''; |
} |
} |
Line 1480 sub parse_basic_search {
|
Line 1484 sub parse_basic_search {
|
&output_blank_field_error($r,$closebutton,'phase=disp_basic'); |
&output_blank_field_error($r,$closebutton,'phase=disp_basic'); |
return OK; |
return OK; |
} |
} |
my $pretty_search_string = '<b>'.$ENV{'form.basicexp'}.'</b>'; |
my $pretty_search_string=''; |
if ($ENV{'form.related'}) { |
my @Queries; |
my @New_Words; |
my $concatarg=join(',', |
($search_string,@New_Words) = &related_version($ENV{'form.basicexp'}); |
('title', 'author', 'subject', 'notes', 'abstract', |
if (@New_Words) { |
'keywords')); |
$pretty_search_string .= " with related words: <b>@New_Words</b>."; |
foreach my $search (&process_phrase_input($search_string)){ |
|
if ($ENV{'form.related'}) { |
|
$pretty_search_string .= ' and <br />' if ($pretty_search_string ne ''); |
|
$pretty_search_string .= '<b>'.$search.'</b>'; |
|
my @New_Words; |
|
($search,@New_Words) = &related_version($search); |
|
next if (! $search); |
|
if (@New_Words) { |
|
$pretty_search_string .= |
|
" with related words: <b>@New_Words</b>"; |
|
} |
} else { |
} else { |
$pretty_search_string .= " with no related words."; |
$pretty_search_string .= ' and ' if ($pretty_search_string ne ''); |
|
$pretty_search_string .= '<b>'.$search.'</b>'; |
} |
} |
|
# |
|
# Build SQL query string based on form page |
|
push(@Queries, |
|
&build_SQL_query('concat_ws(" ",'.$concatarg.')',$search)); |
} |
} |
|
my $final_query = 'SELECT * FROM metadata WHERE '.join(" AND ",@Queries); |
# |
# |
# Build SQL query string based on form page |
|
my $query=''; |
|
my $concatarg=join(',', |
|
('title', 'author', 'subject', 'notes', 'abstract', |
|
'keywords')); |
|
$concatarg='title' if $ENV{'form.titleonly'}; |
|
$query=&build_SQL_query('concat_ws(" ",'.$concatarg.')',$search_string); |
|
if (defined($pretty_domains_string) && $pretty_domains_string ne '') { |
if (defined($pretty_domains_string) && $pretty_domains_string ne '') { |
$pretty_search_string .= ' '.$pretty_domains_string; |
$pretty_search_string .= ' '.$pretty_domains_string; |
} |
} |
$pretty_search_string .= "<br />\n"; |
$pretty_search_string .= "<br />\n"; |
my $final_query = 'SELECT * FROM metadata WHERE '.$query; |
$pretty_search_string =~ s:^<br /> and ::; |
# &Apache::lonnet::logthis($final_query); |
# &Apache::lonnet::logthis($final_query); |
return ($final_query,$pretty_search_string, |
return ($final_query,$pretty_search_string, |
$libraries_to_query); |
$libraries_to_query); |
} |
} |
|
|
|
sub process_phrase_input { |
|
my ($phrase)=@_; |
|
my @Phrases; |
|
# &Apache::lonnet::logthis('phrase = :'.$phrase.':'); |
|
my $in_quotes = 0; |
|
my @Words = split(/\s+/,$phrase); |
|
foreach my $word (@Words) { |
|
$word =~ s/(\w+)\"(\w+)/$1$2/g; |
|
if ($in_quotes) { |
|
if ($word =~ s/(\")$//) { |
|
$in_quotes = 0; |
|
} |
|
if ($Phrases[-1] ne '') { |
|
$Phrases[-1] .= ' '; |
|
} |
|
$Phrases[-1] .= $word; |
|
} else { |
|
if ($word =~ s/^(\")//) { |
|
$in_quotes=1; |
|
} |
|
push(@Phrases,$word); |
|
} |
|
} |
|
# |
|
#foreach my $p (@Phrases) { |
|
# &Apache::lonnet::logthis(' subphrase = '.$p); |
|
#} |
|
# |
|
return @Phrases; |
|
} |
|
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
|
|
Line 1526 Note: Using this twice on a string is pr
|
Line 1570 Note: Using this twice on a string is pr
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
sub related_version { |
sub related_version { |
my $search_string = shift; |
my ($word) = @_; |
my $result = $search_string; |
return (undef) if (lc($word) =~ /\b(or|and|not)\b/); |
my %New_Words = (); |
my @Words = &Apache::loncommon::get_related_words($word); |
while ($search_string =~ /(\w+)/cg) { |
# Only use 4 related words |
my $word = $1; |
@Words = ($#Words>4? @Words[0..4] : @Words); |
next if (lc($word) =~ /\b(or|and|not)\b/); |
my $result = join " OR ", ($word,@Words); |
my @Words = &Apache::loncommon::get_related_words($word); |
return $result,sort(@Words); |
@Words = ($#Words>4? @Words[0..4] : @Words); |
|
foreach (@Words) { $New_Words{$_}++;} |
|
my $replacement = join " OR ", ($word,@Words); |
|
$result =~ s/(\b)$word(\b)/$1($replacement)$2/g; |
|
} |
|
return $result,sort(keys(%New_Words)); |
|
} |
} |
|
|
###################################################################### |
###################################################################### |
Line 1562 sub build_SQL_query {
|
Line 1600 sub build_SQL_query {
|
-build => 'Text::Query::Build'); |
-build => 'Text::Query::Build'); |
$q->prepare($logic_statement); |
$q->prepare($logic_statement); |
my $matchexp=${$q}{'matchexp'}; chomp $matchexp; |
my $matchexp=${$q}{'matchexp'}; chomp $matchexp; |
|
&Apache::lonnet::logthis('matchexp = '.$matchexp); |
my $sql_query=&recursive_SQL_query_build($field_name,$matchexp); |
my $sql_query=&recursive_SQL_query_build($field_name,$matchexp); |
|
&Apache::lonnet::logthis('sql_query = '.$sql_query); |
return $sql_query; |
return $sql_query; |
} |
} |
|
|
Line 1832 a link to change the search query.
|
Line 1872 a link to change the search query.
|
###################################################################### |
###################################################################### |
sub print_sort_form { |
sub print_sort_form { |
my ($r,$pretty_query_string) = @_; |
my ($r,$pretty_query_string) = @_; |
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1); |
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1). |
|
&Apache::lonhtmlcommon::breadcrumbs |
|
(undef,'Searching','Searching',undef,undef, |
|
! ($ENV{'form.catalogmode'} eq 'groupsearch')); |
|
|
## |
## |
my %SortableFields=&Apache::lonlocal::texthash( |
my %SortableFields=&Apache::lonlocal::texthash( |
id => 'Default', |
id => 'Default', |
Line 2098 results into MySQL.
|
Line 2142 results into MySQL.
|
sub run_search { |
sub run_search { |
my ($r,$query,$customquery,$customshow,$serverlist,$pretty_string) = @_; |
my ($r,$query,$customquery,$customshow,$serverlist,$pretty_string) = @_; |
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1); |
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1); |
|
$bodytag.= |
|
&Apache::lonhtmlcommon::breadcrumbs(undef,'Searching','Searching', |
|
undef,undef,! $ENV{'form.launch'}); |
|
|
my $connection = $r->connection; |
my $connection = $r->connection; |
# |
# |
# Print run_search header |
# Print run_search header |
Line 2281 END
|
Line 2329 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("</body></html>"); |
$r->print("</body></html>"); |
if ($ENV{'form.catalogmode'} ne 'groupsearch') { |
# if ($ENV{'form.catalogmode'} ne 'groupsearch') { |
$r->print("<script>". |
$r->print("<script>". |
"window.location='/adm/searchcat?". |
"window.location='/adm/searchcat?". |
"phase=sort&". |
"phase=sort&". |
"persistent_db_id=$ENV{'form.persistent_db_id'}';". |
"persistent_db_id=$ENV{'form.persistent_db_id'}';". |
"</script>"); |
"</script>"); |
} |
# } |
return; |
return; |
} |
} |
|
|
Line 2308 sub prev_next_buttons {
|
Line 2356 sub prev_next_buttons {
|
my ($current_min,$show,$total,$parms) = @_; |
my ($current_min,$show,$total,$parms) = @_; |
return '' if ($show eq 'all'); # No links if you get them all at once. |
return '' if ($show eq 'all'); # No links if you get them all at once. |
# |
# |
# Create links |
# Create buttons |
my $prev_min = $current_min - $show; |
my $buttons = '<input type="submit" name="prev" value="'.&mt('Prev').'" '; |
$prev_min = 1 if $prev_min < 1; |
$buttons .= '/>'; |
my $prevlink = |
$buttons .= ' 'x3; |
qq{<a href="/adm/searchcat?$parms&start=$prev_min&show=$show">}; |
$buttons .= '<input type="submit" name="reload" '. |
# |
'value="'.&mt('Reload').'" />'; |
my $next_min = $current_min + $show; |
$buttons .= ' 'x3; |
$next_min = $current_min if ($next_min > $total); |
$buttons .= '<input type="submit" name="next" value="'.&mt('Next').'" '; |
my $nextlink = |
$buttons .= '/>'; |
qq{<a href="/adm/searchcat?$parms&start=$next_min&show=$show">}; |
return $buttons; |
my $reloadlink = |
|
qq{<a href="/adm/searchcat?$parms&start=$current_min&$show=$show">}; |
|
# |
|
# Determine which parameters to pass |
|
my $String = '[_1]prev[_2] [_3]reload[_4] [_5]next[_6]'; |
|
if ($prev_min == $current_min) { |
|
$String =~ s:\[_[12]\]::g; |
|
} |
|
if ($next_min == $current_min) { |
|
$String =~ s:\[_[56]\]::g; |
|
} |
|
my $links = &mt($String, |
|
$prevlink, '</a>', |
|
$reloadlink,'</a>', |
|
$nextlink, '</a>'); |
|
return $links; |
|
} |
} |
|
|
###################################################################### |
###################################################################### |
Line 2396 sub display_results {
|
Line 2428 sub display_results {
|
} |
} |
## |
## |
## Determine how many results we need to get |
## Determine how many results we need to get |
$ENV{'form.start'} = 1 if (! exists($ENV{'form.start'})); |
$ENV{'form.start'} = 1 if (! exists($ENV{'form.start'})); |
$ENV{'form.show'} = 'all' if (! exists($ENV{'form.show'})); |
$ENV{'form.show'} = 20 if (! exists($ENV{'form.show'})); |
|
if (exists($ENV{'form.prev'})) { |
|
$ENV{'form.start'} -= $ENV{'form.show'}; |
|
} elsif (exists($ENV{'form.next'})) { |
|
$ENV{'form.start'} += $ENV{'form.show'}; |
|
} |
|
$ENV{'form.start'} = 1 if ($ENV{'form.start'}<1); |
|
$ENV{'form.start'} = $total_results if ($ENV{'form.start'}>$total_results); |
my $min = $ENV{'form.start'}; |
my $min = $ENV{'form.start'}; |
my $max; |
my $max; |
if ($ENV{'form.show'} eq 'all') { |
if ($ENV{'form.show'} eq 'all') { |
Line 2407 sub display_results {
|
Line 2446 sub display_results {
|
$max = $total_results if ($max > $total_results); |
$max = $total_results if ($max > $total_results); |
} |
} |
## |
## |
|
## Output form elements |
|
$r->print(&hidden_field('table'). |
|
&hidden_field('phase'). |
|
&hidden_field('persistent_db_id'). |
|
&hidden_field('start') |
|
); |
|
## |
## Output links (if necessary) for 'prev' and 'next' pages. |
## Output links (if necessary) for 'prev' and 'next' pages. |
$r->print |
$r->print |
('<center>'. |
('<table width="100%"><tr><td width="50%" align="right">'. |
&prev_next_buttons($min,$ENV{'form.show'},$total_results, |
&prev_next_buttons($min,$ENV{'form.show'},$total_results). |
"table=".$ENV{'form.table'}. |
'</td><td align="right">'. |
"&phase=results". |
&viewoptions().'</td></tr></table>' |
"&persistent_db_id=".$ENV{'form.persistent_db_id'}) |
|
."</center>\n" |
|
); |
); |
if ($total_results == 0) { |
if ($total_results == 0) { |
$r->print('<meta HTTP-EQUIV="Refresh" CONTENT="2">'. |
$r->print('<meta HTTP-EQUIV="Refresh" CONTENT="2">'. |
Line 2753 SCRIPT
|
Line 2797 SCRIPT
|
$result.=<<END; |
$result.=<<END; |
</head> |
</head> |
$bodytag |
$bodytag |
<form name="results" method="post" action="" > |
<form name="results" method="post" action="/adm/searchcat" > |
<input type="hidden" name="Queue" value="" /> |
<input type="hidden" name="Queue" value="" /> |
$importbutton |
$importbutton |
END |
END |
Line 2811 ENDFRAMES
|
Line 2855 ENDFRAMES
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
|
|
|
sub has_stat_data { |
|
my ($values) = @_; |
|
if ( (defined($values->{'count'}) && $values->{'count'} ne '') || |
|
(defined($values->{'stdno'}) && $values->{'stdno'} ne '') || |
|
(defined($values->{'disc'}) && $values->{'disc'} ne '') || |
|
(defined($values->{'avetries'}) && $values->{'avetries'} ne '') || |
|
(defined($values->{'difficulty'}) && $values->{'difficulty'} ne '')) { |
|
return 1; |
|
} |
|
return 0; |
|
} |
|
|
|
sub statfields { |
|
return ('count','stdno','disc','avetries','difficulty'); |
|
} |
|
|
|
sub has_eval_data { |
|
my ($values) = @_; |
|
if ( (defined($values->{'clear'}) && $values->{'clear'} ne '') || |
|
(defined($values->{'technical'}) && $values->{'technical'} ne '') || |
|
(defined($values->{'correct'}) && $values->{'correct'} ne '') || |
|
(defined($values->{'helpful'}) && $values->{'helpful'} ne '') || |
|
(defined($values->{'depth'}) && $values->{'depth'} ne '')) { |
|
return 1; |
|
} |
|
return 0; |
|
} |
|
|
|
sub evalfields { |
|
return ('clear','technical','correct','helpful','depth'); |
|
} |
|
|
|
###################################################################### |
|
###################################################################### |
|
|
=pod |
=pod |
|
|
=item Metadata Viewing Functions |
=item Metadata Viewing Functions |
Line 2832 extra custom metadata to show.
|
Line 2911 extra custom metadata to show.
|
###################################################################### |
###################################################################### |
sub detailed_citation_view { |
sub detailed_citation_view { |
my ($prefix,%values) = @_; |
my ($prefix,%values) = @_; |
my $icon= |
|
my $result; |
my $result; |
$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="http://'.$ENV{'HTTP_HOST'}.$values{'url'}.'" '. |
'target="search_preview">'.$values{'title'}."</a></b>\n"; |
'target="search_preview">'.$values{'title'}."</a></b>\n"; |
$result .= "<p>\n"; |
$result .= "<p>\n"; |
Line 2843 sub detailed_citation_view {
|
Line 2921 sub detailed_citation_view {
|
' <i>'.$values{'owner'}.'</i><br />'; |
' <i>'.$values{'owner'}.'</i><br />'; |
foreach my $field |
foreach my $field |
( |
( |
|
{ name=>'url', |
|
translate => '<b>URL:</b> [_1]', |
|
special => 'url link',}, |
{ name=>'subject', |
{ name=>'subject', |
translate => '<b>Subject:</b> [_1]',}, |
translate => '<b>Subject:</b> [_1]',}, |
{ name=>'keywords', |
{ name=>'keywords', |
Line 2855 sub detailed_citation_view {
|
Line 2936 sub detailed_citation_view {
|
translate => '<b>Standards:</b>[_1]',}, |
translate => '<b>Standards:</b>[_1]',}, |
{ name=>'copyrighttag', |
{ name=>'copyrighttag', |
translate => '<b>Copyright/Distribution:</b> [_1]',}, |
translate => '<b>Copyright/Distribution:</b> [_1]',}, |
|
{ name=>'count', |
|
format => "%d", |
|
translate => '<b>Access Count:</b> [_1]',}, |
{ name=>'stdno', |
{ name=>'stdno', |
|
format => "%d", |
translate => '<b>Number of Students:</b> [_1]',}, |
translate => '<b>Number of Students:</b> [_1]',}, |
{ name=>'avetries', |
{ name=>'avetries', |
|
format => "%.2f", |
translate => '<b>Average Tries:</b> [_1]',}, |
translate => '<b>Average Tries:</b> [_1]',}, |
{ name=>'disc', |
{ name=>'disc', |
|
format => "%.2f", |
translate => '<b>Degree of Discrimination:</b> [_1]',}, |
translate => '<b>Degree of Discrimination:</b> [_1]',}, |
{ name=>'difficulty', |
{ name=>'difficulty', |
|
format => "%.2f", |
translate => '<b>Degree of Difficulty:</b> [_1]',}, |
translate => '<b>Degree of Difficulty:</b> [_1]',}, |
{ name=>'clear', |
{ name=>'clear', |
|
format => "%.2f", |
translate => '<b>Clear:</b> [_1]',}, |
translate => '<b>Clear:</b> [_1]',}, |
{ name=>'depth', |
{ name=>'depth', |
|
format => "%.2f", |
translate => '<b>Depth:</b> [_1]',}, |
translate => '<b>Depth:</b> [_1]',}, |
{ name=>'helpful', |
{ name=>'helpful', |
|
format => "%.2f", |
translate => '<b>Helpful:</b> [_1]',}, |
translate => '<b>Helpful:</b> [_1]',}, |
{ name=>'correct', |
{ name=>'correct', |
translate => '<b>Correcy:</b> [_1]',}, |
format => "%.2f", |
|
translate => '<b>Correct:</b> [_1]',}, |
{ name=>'technical', |
{ name=>'technical', |
|
format => "%.2f", |
translate => '<b>Technical:</b> [_1]',}, |
translate => '<b>Technical:</b> [_1]',}, |
|
{ name=>'comefrom_list', |
|
type => 'list', |
|
translate => 'Resources that lead up to this resource in maps',}, |
|
{ name=>'goto_list', |
|
type => 'list', |
|
translate => 'Resources that follow this resource in maps',}, |
|
{ name=>'usage_list', |
|
type => 'list', |
|
translate => 'Resources using or importing resource',}, |
) { |
) { |
$result.= &mt($field->{'translate'},$values{$field->{'name'}}). |
next if (! exists($values{$field->{'name'}}) || |
"<br />\n"; |
$values{$field->{'name'}} eq ''); |
|
if (exists($field->{'type'}) && $field->{'type'} eq 'list') { |
|
$result .= '<b>'.&mt($field->{'translate'}).'</b><ul>'; |
|
foreach my $item (split(',',$values{$field->{'name'}})){ |
|
$result .= '<li>'. |
|
'<a target="search_preview" '. |
|
'href="/res/'.$item.'">'.$item.'</a></li>'; |
|
} |
|
$result .= '</ul>'; |
|
} elsif (exists($field->{'format'}) && $field->{'format'} ne ''){ |
|
$result.= &mt($field->{'translate'}, |
|
sprintf($field->{'format'}, |
|
$values{$field->{'name'}})).'<br />'."\n"; |
|
} else { |
|
if ($field->{'special'} eq 'url link') { |
|
$result.= |
|
&mt($field->{'translate'}, |
|
'<a href="'.$values{'url'}.'" '. |
|
'target="search_preview">'. |
|
$values{$field->{'name'}}. |
|
'</a>'); |
|
} else { |
|
$result.= &mt($field->{'translate'}, |
|
$values{$field->{'name'}}); |
|
} |
|
$result .= "<br />\n"; |
|
} |
} |
} |
$result .= "</p>".$values{'extrashow'}. |
$result .= "</p>"; |
'<p>'.$values{'shortabstract'}.'</p>'; |
if (exists($values{'extrashow'}) && $values{'extrashow'} ne '') { |
$result .= '<hr align="left" width="200" noshade />'."\n"; |
$result .= '<p>'.$values{'extrashow'}.'</p>'; |
return $result; |
|
} |
|
|
|
###################################################################### |
|
###################################################################### |
|
|
|
sub has_stat_data { |
|
my ($values) = @_; |
|
if ( (defined($values->{'count'}) && $values->{'count'} ne '') || |
|
(defined($values->{'stdno'}) && $values->{'stdno'} ne '') || |
|
(defined($values->{'disc'}) && $values->{'disc'} ne '') || |
|
(defined($values->{'avetries'}) && $values->{'avetries'} ne '') || |
|
(defined($values->{'difficulty'}) && $values->{'difficulty'} ne '')) { |
|
return 1; |
|
} |
} |
return 0; |
if (exists($values{'shortabstract'}) && $values{'shortabstract'} ne '') { |
} |
$result .= '<p>'.$values{'shortabstract'}.'</p>'; |
|
|
sub statfields { |
|
return ('count','stdno','disc','avetries','difficulty'); |
|
} |
|
|
|
sub has_eval_data { |
|
my ($values) = @_; |
|
if ( (defined($values->{'clear'}) && $values->{'clear'} ne '') || |
|
(defined($values->{'technical'}) && $values->{'technical'} ne '') || |
|
(defined($values->{'correct'}) && $values->{'correct'} ne '') || |
|
(defined($values->{'helpful'}) && $values->{'helpful'} ne '') || |
|
(defined($values->{'depth'}) && $values->{'depth'} ne '')) { |
|
return 1; |
|
} |
} |
return 0; |
$result .= '<hr align="left" width="200" noshade />'."\n"; |
} |
return $result; |
|
|
sub evalfields { |
|
return ('clear','technical','correct','helpful','depth'); |
|
} |
} |
|
|
###################################################################### |
###################################################################### |
Line 2932 sub summary_view {
|
Line 3030 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=<<END; |
my $result=<<END; |
$prefix<img src="$icon" /><a href="http://$ENV{'HTTP_HOST'}$values{'url'}" |
$prefix<img src="$icon" /> |
|
<a href="http://$ENV{'HTTP_HOST'}$values{'url'}" |
target='search_preview'>$values{'author'}</a><br /> |
target='search_preview'>$values{'author'}</a><br /> |
$values{'title'}<br /> |
$values{'title'}<br /> |
$values{'owner'} -- $values{'lastrevisiondate'}<br /> |
$values{'owner'} -- $values{'lastrevisiondate'}<br /> |
Line 2957 END
|
Line 3056 END
|
###################################################################### |
###################################################################### |
sub compact_view { |
sub compact_view { |
my ($prefix,%values) = @_; |
my ($prefix,%values) = @_; |
my $icon=&Apache::loncommon::icon($values{'url'}); |
my $result = |
my $result=<<END; |
$prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}). |
$prefix <img src="$icon" /> <a href="http://$ENV{'HTTP_HOST'}$values{'url'}" target='search_preview'> |
'"> <a href="'.$values{'url'}.'" target="search_preview">'. |
$values{'title'}</a> |
$values{'title'}.'</a>'.(' 'x2). |
<b>$values{'author'}</b><br /> |
'<b>'.$values{'author'}.'</b><br />'; |
END |
|
return $result; |
return $result; |
} |
} |
|
|