--- loncom/interface/lonsearchcat.pm 2004/05/05 14:14:10 1.222 +++ loncom/interface/lonsearchcat.pm 2004/05/05 17:29:06 1.223 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.222 2004/05/05 14:14:10 matthew Exp $ +# $Id: lonsearchcat.pm,v 1.223 2004/05/05 17:29:06 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -231,24 +231,19 @@ END $hidden_fields = ''."\n"; if (exists($ENV{'form.catalogmode'})) { - $hidden_fields .= ''."\n"; + $hidden_fields .= &hidden_field('catalogmode'); } if (exists($ENV{'form.form'})) { - $hidden_fields .= ''."\n"; + $hidden_fields .= &hidden_field('form'); } if (exists($ENV{'form.element'})) { - $hidden_fields .= ''."\n"; + $hidden_fields .= &hidden_field('element'); } if (exists($ENV{'form.titleelement'})) { - $hidden_fields .= ''."\n"; + $hidden_fields .= &hidden_field('titleelement'); } if (exists($ENV{'form.mode'})) { - $hidden_fields .= ''."\n"; + $hidden_fields .= &hidden_field('mode'); } ## ## Configure dynamic components of interface @@ -422,6 +417,14 @@ sub clean_up_environment { } } +sub hidden_field { + my ($name,$value) = @_; + if (! defined($value)) { + $value = $ENV{'form.'.$name}; + } + return ''.$/; +} + ###################################################################### ###################################################################### ## @@ -616,7 +619,8 @@ sub print_basic_search_form { ''. ''. - (' 'x2).$closebutton.(' 'x2).&viewoptions(). + (' 'x2).$closebutton.(' 'x2). + &viewoptions(). ''. ''.$/; $scrout .= ''.$/.''.''; @@ -959,7 +963,7 @@ Outputs: text for box with view options ###################################################################### ###################################################################### sub viewoptions { - my $scrout="\n".''; + my $scrout; if (! defined($ENV{'form.viewselect'})) { $ENV{'form.viewselect'}='detailed'; } @@ -2308,32 +2312,16 @@ sub prev_next_buttons { my ($current_min,$show,$total,$parms) = @_; return '' if ($show eq 'all'); # No links if you get them all at once. # - # Create links - my $prev_min = $current_min - $show; - $prev_min = 1 if $prev_min < 1; - my $prevlink = - qq{}; - # - my $next_min = $current_min + $show; - $next_min = $current_min if ($next_min > $total); - my $nextlink = - qq{}; - my $reloadlink = - qq{}; - # - # 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, '', - $reloadlink,'', - $nextlink, ''); - return $links; + # Create buttons + my $buttons = ''; + $buttons .= ' 'x3; + $buttons .= '$total_results); my $min = $ENV{'form.start'}; my $max; if ($ENV{'form.show'} eq 'all') { @@ -2407,14 +2402,19 @@ sub display_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. $r->print - ('
'. - &prev_next_buttons($min,$ENV{'form.show'},$total_results, - "table=".$ENV{'form.table'}. - "&phase=results". - "&persistent_db_id=".$ENV{'form.persistent_db_id'}) - ."
\n" + ('
'. + &prev_next_buttons($min,$ENV{'form.show'},$total_results). + ''. + &viewoptions().'
' ); if ($total_results == 0) { $r->print(''. @@ -2753,7 +2753,7 @@ SCRIPT $result.=< $bodytag -
+ $importbutton END @@ -2832,10 +2832,9 @@ extra custom metadata to show. ###################################################################### sub detailed_citation_view { my ($prefix,%values) = @_; - my $icon= my $result; $result .= ''.$prefix. - ''. + ''.' '. ''.$values{'title'}."\n"; $result .= "

\n"; @@ -2843,6 +2842,9 @@ sub detailed_citation_view { ' '.$values{'owner'}.'
'; foreach my $field ( + { name=>'url', + translate => 'URL: [_1]', + special => 'url link',}, { name=>'subject', translate => 'Subject: [_1]',}, { name=>'keywords', @@ -2855,6 +2857,8 @@ sub detailed_citation_view { translate => 'Standards:[_1]',}, { name=>'copyrighttag', translate => 'Copyright/Distribution: [_1]',}, + { name=>'count', + translate => 'Access Count: [_1]',}, { name=>'stdno', translate => 'Number of Students: [_1]',}, { name=>'avetries', @@ -2874,11 +2878,29 @@ sub detailed_citation_view { { name=>'technical', translate => 'Technical: [_1]',}, ) { - $result.= &mt($field->{'translate'},$values{$field->{'name'}}). - "
\n"; + if (exists($values{$field->{'name'}}) && + $values{$field->{'name'}} ne '') { + if ($field->{'special'} eq 'url link') { + $result.= + &mt($field->{'translate'}, + ''. + $values{$field->{'name'}}. + ''); + } else { + $result.= &mt($field->{'translate'}, + $values{$field->{'name'}}); + } + $result .= "
\n"; + } + } + $result .= "

"; + if (exists($values{'extrashow'}) && $values{'extrashow'} ne '') { + $result .= '

'.$values{'extrashow'}.'

'; + } + if (exists($values{'shortabstract'}) && $values{'shortabstract'} ne '') { + $result .= '

'.$values{'shortabstract'}.'

'; } - $result .= "

".$values{'extrashow'}. - '

'.$values{'shortabstract'}.'

'; $result .= '
'."\n"; return $result; } @@ -2932,7 +2954,8 @@ sub summary_view { my ($prefix,%values) = @_; my $icon=&Apache::loncommon::icon($values{'url'}); my $result=<  +$values{'author'}
$values{'title'}
$values{'owner'} -- $values{'lastrevisiondate'}
@@ -2957,12 +2980,11 @@ END ###################################################################### sub compact_view { my ($prefix,%values) = @_; - my $icon=&Apache::loncommon::icon($values{'url'}); - my $result=< -$values{'title'} -$values{'author'}
-END + my $result = + $prefix.' '. + $values{'title'}.''.(' 'x2). + ''.$values{'author'}.'
'; return $result; }