--- loncom/interface/lonsearchcat.pm 2005/06/27 22:01:46 1.246 +++ loncom/interface/lonsearchcat.pm 2005/12/29 19:45:19 1.250 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.246 2005/06/27 22:01:46 albertel Exp $ +# $Id: lonsearchcat.pm,v 1.250 2005/12/29 19:45:19 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -283,12 +283,7 @@ END ## Sanity checks on form elements ## if (!defined($env{'form.viewselect'})) { - if (($env{'form.catalogmode'} eq 'groupsearch') || - ($env{'form.catalogmode'} eq 'interactive')) { - $env{'form.viewselect'} ="Compact View"; - } else { - $env{'form.viewselect'} ="Detailed Citation View"; - } + $env{'form.viewselect'} ="summary"; } $env{'form.phase'} = 'disp_basic' if (! exists($env{'form.phase'})); $env{'form.show'} = 20 if (! exists($env{'form.show'})); @@ -708,6 +703,10 @@ sub print_basic_search_form { ), $r->dir_config('lonDefDomain') ).''; + my $inclext= ''; my $adv_search_link = ''. @@ -902,7 +902,10 @@ ENDHEADER &titlefield(&mt('Domains')).''. &Apache::loncommon::domain_select('domains', $env{'form.domains'},1). - ''.$/; + '
'.$/; # # Misc metadata $scrout.=''. @@ -2288,7 +2291,7 @@ sub update_status { } { - my $max_time = 40; # seconds for the search to complete + my $max_time = 300; # seconds for the search to complete my $start_time = 0; my $last_time = 0; @@ -2522,8 +2525,11 @@ END my %Fields = &parse_raw_result($result,$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 next if (! ©right_check(\%Fields)); + # # Store the result in the mysql database my $result = &Apache::lonmysql::store_row($table,\%Fields); @@ -2725,7 +2731,15 @@ sub display_results { } my %sort_fields = map {$_->{'key'},$_->{'desc'}} @fields; $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]', &Apache::loncommon::select_form($env{'form.sortfield'}, 'sortfield', @@ -2776,7 +2790,7 @@ sub display_results { exists($sort_fields{$env{'form.sortfield'}})) { $sort_command = $env{'form.sortfield'}.' IS NOT NULL '. 'ORDER BY '.$env{'form.sortfield'}.' '.$order. - ' LIMIT '.($min-1).','.($max-$min); + ' LIMIT '.($min-1).','.($max-$min+1); } my @Results = &Apache::lonmysql::get_rows($table,$sort_command); ## @@ -3222,9 +3236,11 @@ extra custom metadata to show. sub detailed_citation_view { my ($prefix,%values) = @_; my $result; + my $jumpurl=$values{'url'}; + $jumpurl=~s/^\/ext\//http\:\/\//; $result .= ''.$prefix. ''.' '. - '
'.$values{'title'}."\n"; $result .= "

\n"; $result .= ''.$values{'author'}.','. @@ -3293,7 +3309,7 @@ sub detailed_citation_view { foreach my $item (split(',',$values{$field->{'name'}})){ $result .= '

  • '. ''.$item.'
  • '; + 'href="'.$jumpurl.'">'.$item.''; } $result .= ''; } elsif (exists($field->{'format'}) && $field->{'format'} ne ''){ @@ -3304,7 +3320,7 @@ sub detailed_citation_view { if ($field->{'special'} eq 'url link') { $result.= &mt($field->{'translate'}, - ''. $values{$field->{'name'}}. ''); @@ -3352,8 +3368,11 @@ sub summary_view { if (! defined($tmp)) { $tmp = 'undefined'; } $result .= ' '.$tmp.' '; } + my $jumpurl=$values{'url'}; + $jumpurl=~s/^\/ext\//http\:\/\//; + $result.=<$values{'title'}
    $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}
    $values{'copyrighttag'}
    @@ -3377,6 +3396,9 @@ END ###################################################################### sub compact_view { my ($prefix,%values) = @_; + my $jumpurl=$values{'url'}; + $jumpurl=~s/^\/ext\//http\:\/\//; + my $result = $prefix.''; if (exists($env{'form.sortfield'}) && @@ -3385,9 +3407,9 @@ sub compact_view { if (! defined($tmp)) { $tmp = 'undefined'; } $result .= ' '.$tmp.' '; } - $result.=' '. + $result.=' '. $values{'title'}.''.(' 'x2). - ''.$values{'author'}.'
    '; + ''.$values{'author'}.' ('.$values{'domain'}.')
    '; return $result; } @@ -3407,11 +3429,14 @@ sub fielded_format_view { my ($prefix,%values) = @_; my $icon=&Apache::loncommon::icon($values{'url'}); my %Translated = &Apache::lonmeta::fieldnames(); + my $jumpurl=$values{'url'}; + $jumpurl=~s/^\/ext\//http\:\/\//; + my $result=<
    URL:
    -
    $values{'url'}
    END foreach my $field ('title','author','domain','subject','keywords','notes',