version 1.221, 2004/05/04 15:20:17
|
version 1.224, 2004/05/07 18:50:14
|
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 790 ENDHEADER
|
Line 794 ENDHEADER
|
$scrout .= '<tr><td> </td><td align="center">'.&mt('Minimum').'</td>'. |
$scrout .= '<tr><td> </td><td align="center">'.&mt('Minimum').'</td>'. |
'<td align="center">'.&mt('Maximum').'</td></tr>'."\n"; |
'<td align="center">'.&mt('Maximum').'</td></tr>'."\n"; |
foreach my $statistic |
foreach my $statistic |
({ name=>'stdno', |
({ name=>'count', |
description=>'Number of Students',}, |
description=>'Network-wide number of accesses (hits)',}, |
|
{ name=>'stdno', |
|
description=> |
|
'Total number of students who have worked on this problem',}, |
{ name => 'avetries', |
{ name => 'avetries', |
description=>'Average tries to answer correctly',}, |
description=>'Average number of tries till solved',}, |
{ name => 'difficulty', |
{ name => 'difficulty', |
description=>'Degree of difficulty',}, |
description=>'Degree of difficulty',}, |
{ name => 'disc', |
{ name => 'disc', |
Line 956 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 1184 sub parse_advanced_search {
|
Line 1191 sub parse_advanced_search {
|
'notes','abstract','extension','owner', |
'notes','abstract','extension','owner', |
# 'custommetadata','customshow', |
# 'custommetadata','customshow', |
'modifyinguser','standards','mime'); |
'modifyinguser','standards','mime'); |
my @StatsFields = ('stdno','avetries','difficulty','disc'); |
my @StatsFields = &statfields(); |
my @EvalFields = ('clear','depth','helpful','correct','technical'); |
my @EvalFields = &evalfields(); |
my $fillflag=0; |
my $fillflag=0; |
my $pretty_search_string = "<br />\n"; |
my $pretty_search_string = "<br />\n"; |
# Clean up fields for safety |
# Clean up fields for safety |
Line 1210 sub parse_advanced_search {
|
Line 1217 sub parse_advanced_search {
|
ref($ENV{'form.category'})); |
ref($ENV{'form.category'})); |
# |
# |
# Check to see if enough information was filled in |
# Check to see if enough information was filled in |
for my $field (@BasicFields) { |
foreach my $field (@BasicFields) { |
if (&filled($ENV{'form.'.$field})) { |
if (&filled($ENV{'form.'.$field})) { |
$fillflag++; |
$fillflag++; |
} |
} |
} |
} |
|
foreach my $field (@StatsFields,@EvalFields) { |
|
if (&filled($ENV{'form.'.$field.'_max'})) { |
|
$fillflag++; |
|
} |
|
if (&filled($ENV{'form.'.$field.'_min'})) { |
|
$fillflag++; |
|
} |
|
} |
|
|
for my $field ('lowestgradelevel','highestgradelevel') { |
for my $field ('lowestgradelevel','highestgradelevel') { |
if ( $ENV{'form.'.$field} =~ /^\d+$/ && |
if ( $ENV{'form.'.$field} =~ /^\d+$/ && |
$ENV{'form.'.$field} > 0) { |
$ENV{'form.'.$field} > 0) { |
Line 1232 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 1247 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 1384 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 1468 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)){ |
} else { |
$pretty_search_string .= '<br />'.'<b>'.$search.'</b>'; |
$pretty_search_string .= " with no related words."; |
if ($ENV{'form.related'}) { |
|
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>"; |
|
} |
} |
} |
|
# |
|
# 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 />::; |
# &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 1514 Note: Using this twice on a string is pr
|
Line 1566 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 1550 sub build_SQL_query {
|
Line 1596 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 1820 a link to change the search query.
|
Line 1868 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 2086 results into MySQL.
|
Line 2138 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 2269 END
|
Line 2325 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 2296 sub prev_next_buttons {
|
Line 2352 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 2384 sub display_results {
|
Line 2424 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 2395 sub display_results {
|
Line 2442 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 2741 SCRIPT
|
Line 2793 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 2799 ENDFRAMES
|
Line 2851 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 2820 extra custom metadata to show.
|
Line 2907 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 2831 sub detailed_citation_view {
|
Line 2917 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 2843 sub detailed_citation_view {
|
Line 2932 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', |
|
translate => '<b>Access Count:</b> [_1]',}, |
{ name=>'stdno', |
{ name=>'stdno', |
translate => '<b>Number of Students:</b> [_1]',}, |
translate => '<b>Number of Students:</b> [_1]',}, |
{ name=>'avetries', |
{ name=>'avetries', |
Line 2858 sub detailed_citation_view {
|
Line 2949 sub detailed_citation_view {
|
{ name=>'helpful', |
{ name=>'helpful', |
translate => '<b>Helpful:</b> [_1]',}, |
translate => '<b>Helpful:</b> [_1]',}, |
{ name=>'correct', |
{ name=>'correct', |
translate => '<b>Correcy:</b> [_1]',}, |
translate => '<b>Correct:</b> [_1]',}, |
{ name=>'technical', |
{ name=>'technical', |
translate => '<b>Technical:</b> [_1]',}, |
translate => '<b>Technical:</b> [_1]',}, |
) { |
) { |
$result.= &mt($field->{'translate'},$values{$field->{'name'}}). |
if (exists($values{$field->{'name'}}) && |
"<br />\n"; |
$values{$field->{'name'}} ne '') { |
|
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>"; |
|
if (exists($values{'extrashow'}) && $values{'extrashow'} ne '') { |
|
$result .= '<p>'.$values{'extrashow'}.'</p>'; |
|
} |
|
if (exists($values{'shortabstract'}) && $values{'shortabstract'} ne '') { |
|
$result .= '<p>'.$values{'shortabstract'}.'</p>'; |
} |
} |
$result .= "</p>".$values{'extrashow'}. |
|
'<p>'.$values{'shortabstract'}.'</p>'; |
|
$result .= '<hr align="left" width="200" noshade />'."\n"; |
$result .= '<hr align="left" width="200" noshade />'."\n"; |
return $result; |
return $result; |
} |
} |
Line 2885 sub summary_view {
|
Line 2994 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 2910 END
|
Line 3020 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; |
} |
} |
|
|
Line 2934 END
|
Line 3043 END
|
sub fielded_format_view { |
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 $result=<<END; |
my $result=<<END; |
$prefix <img src="$icon" /> |
$prefix <img src="$icon" /> |
<b>URL: </b> <a href="http://$ENV{'HTTP_HOST'}$values{'url'}" |
<dl> |
target='search_preview'>$values{'url'}</a> |
<dt>URL:</dt> |
<br /> |
<dd><a href="http://$ENV{'HTTP_HOST'}$values{'url'}" |
<b>Title:</b> $values{'title'}<br /> |
target='search_preview'>$values{'url'}</a></dd> |
<b>Author(s):</b> $values{'author'}<br /> |
|
<b>Subject:</b> $values{'subject'}<br /> |
|
<b>Keyword(s):</b> $values{'keywords'}<br /> |
|
<b>Notes:</b> $values{'notes'}<br /> |
|
<b>MIME Type:</b> $values{'mimetag'}<br /> |
|
<b>Language:</b> $values{'language'}<br /> |
|
<b>Creation Date:</b> $values{'creationdate'}<br /> |
|
<b>Last Revision Date:</b> $values{'lastrevisiondate'}<br /> |
|
<b>Publisher/Owner:</b> $values{'owner'}<br /> |
|
<b>Copyright/Distribution:</b> $values{'copyrighttag'}<br /> |
|
<b>Repository Location:</b> $values{'hostname'}<br /> |
|
<b>Abstract:</b> $values{'shortabstract'}<br /> |
|
$values{'extrashow'} |
|
</p> |
|
<hr align='left' width='200' noshade /> |
|
END |
END |
|
foreach my $field ('title','author','subject','keywords','notes', |
|
'mimetag','language','creationdate','lastrevisiondate', |
|
'owner','copyrighttag','hostname','abstract') { |
|
$result .= (' 'x4).'<dt>'.$Translated{$field}.'</dt>'."\n". |
|
(' 'x8).'<dd>'.$values{$field}.'</dd>'."\n"; |
|
} |
|
if (&has_stat_data(\%values)) { |
|
foreach my $field (&statfields()) { |
|
$result .= (' 'x4).'<dt>'.$Translated{$field}.'</dt>'."\n". |
|
(' 'x8).'<dd>'.$values{$field}.'</dd>'."\n"; |
|
} |
|
} |
|
if (&has_eval_data(\%values)) { |
|
foreach my $field (&evalfields()) { |
|
$result .= (' 'x4).'<dt>'.$Translated{$field}.'</dt>'."\n". |
|
(' 'x8).'<dd>'.$values{$field}.'</dd>'."\n"; |
|
} |
|
} |
|
$result .= "</dl>\n"; |
|
$result .= $values{'extrashow'}; |
|
$result .= '<hr align="left" width="200" noshade />'."\n"; |
return $result; |
return $result; |
} |
} |
|
|
Line 2974 END
|
Line 3090 END
|
###################################################################### |
###################################################################### |
sub xml_sgml_view { |
sub xml_sgml_view { |
my ($prefix,%values) = @_; |
my ($prefix,%values) = @_; |
my $xml = <<END; |
my $xml = '<LonCapaResource>'."\n"; |
<LonCapaResource> |
# The usual suspects |
<url>$values{'url'}</url> |
foreach my $field ('url','title','author','subject','keywords','notes') { |
<title>$values{'title'}</title> |
$xml .= qq{<$field>$values{$field}</$field>}."\n"; |
<author>$values{'author'}</author> |
} |
<subject>$values{'subject'}</subject> |
# |
<keywords>$values{'keywords'}</keywords> |
$xml .= "<mimeInfo>\n"; |
<notes>$values{'notes'}</notes> |
foreach my $field ('mime','mimetag') { |
<mimeInfo> |
$xml .= qq{<$field>$values{$field}</$field>}."\n"; |
<mime>$values{'mime'}</mime> |
} |
<mimetag>$values{'mimetag'}</mimetag> |
$xml .= "</mimeInfo>\n"; |
</mimeInfo> |
# |
<languageInfo> |
$xml .= "<languageInfo>\n"; |
<language>$values{'language'}</language> |
foreach my $field ('language','languagetag') { |
<languagetag>$values{'languagetag'}</languagetag> |
$xml .= qq{<$field>$values{$field}</$field>}."\n"; |
</languageInfo> |
} |
<creationdate>$values{'creationdate'}</creationdate> |
$xml .= "</languageInfo>\n"; |
<lastrevisiondate>$values{'lastrevisiondate'}</lastrevisiondate> |
# |
<owner>$values{'owner'}</owner> |
foreach my $field ('creationdate','lastrevisiondate','owner') { |
<copyrightInfo> |
$xml .= qq{<$field>$values{$field}</$field>}."\n"; |
<copyright>$values{'copyright'}</copyright> |
} |
<copyrighttag>$values{'copyrighttag'}</copyrighttag> |
# |
</copyrightInfo> |
$xml .= "<copyrightInfo>\n"; |
<repositoryLocation>$values{'hostname'}</repositoryLocation> |
foreach my $field ('copyright','copyrighttag') { |
<shortabstract>$values{'shortabstract'}</shortabstract> |
$xml .= qq{<$field>$values{$field}</$field>}."\n"; |
</LonCapaResource> |
} |
END |
$xml .= "</copyrightInfo>\n"; |
|
$xml .= qq{<repositoryLocation>$values{'hostname'}</repositoryLocation>}. |
|
"\n"; |
|
$xml .= qq{<shortabstract>$values{'shortabstract'}</shortabstract>}."\n"; |
|
# |
|
if (&has_stat_data(\%values)){ |
|
$xml .= "<problemstatistics>\n"; |
|
foreach my $field (&statfields()) { |
|
$xml .= qq{<$field>$values{$field}</$field>}."\n"; |
|
} |
|
$xml .= "</problemstatistics>\n"; |
|
} |
|
# |
|
if (&has_eval_data(\%values)) { |
|
$xml .= "<evaluation>\n"; |
|
foreach my $field (&evalfields) { |
|
$xml .= qq{<$field>$values{$field}</$field>}."\n"; |
|
} |
|
$xml .= "</evaluation>\n"; |
|
} |
|
# |
|
$xml .= "</LonCapaResource>\n"; |
$xml = &HTML::Entities::encode($xml,'<>&'); |
$xml = &HTML::Entities::encode($xml,'<>&'); |
my $result=<<END; |
my $result=<<END; |
$prefix |
$prefix |