--- loncom/interface/lonsearchcat.pm 2005/04/07 06:56:23 1.243 +++ loncom/interface/lonsearchcat.pm 2005/04/07 06:59:55 1.244 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.243 2005/04/07 06:56:23 albertel Exp $ +# $Id: lonsearchcat.pm,v 1.244 2005/04/07 06:59:55 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2685,66 +2685,6 @@ sub display_results { ); # # 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 = ( {key=>'default' }, @@ -2788,13 +2728,12 @@ 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'} = 'asc' if (! exists($env{'form.sortorder'})); my $sortform = &mt('Sort by [_1] [_2]', - &Apache::loncommon::select_form($ENV{'form.sortfield'}, ->>>>>>> 1.242 + &Apache::loncommon::select_form($env{'form.sortfield'}, 'sortfield', %sort_fields), - &Apache::loncommon::select_form($ENV{'form.sortorder'}, + &Apache::loncommon::select_form($env{'form.sortorder'}, 'sortorder', (asc =>&mt('Ascending'), desc=>&mt('Descending') @@ -2824,17 +2763,11 @@ sub display_results { ## ## Get results from MySQL table 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; - if (exists($ENV{'form.sortorder'})) { - if ($ENV{'form.sortorder'} eq 'asc') { + if (exists($env{'form.sortorder'})) { + if ($env{'form.sortorder'} eq 'asc') { $order = 'ASC'; - } elsif ($ENV{'form.sortorder'} eq 'desc') { + } elsif ($env{'form.sortorder'} eq 'desc') { $order = 'DESC'; } else { $order = ''; @@ -2842,11 +2775,10 @@ sub display_results { } else { $order = ''; } - 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'}.' '.$order. ->>>>>>> 1.242 + 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'}.' '.$order. ' LIMIT '.($min-1).','.($max-$min); } my @Results = &Apache::lonmysql::get_rows($table,$sort_command); @@ -3411,15 +3343,15 @@ sub summary_view { my ($prefix,%values) = @_; my $icon=&Apache::loncommon::icon($values{'url'}); my $result=qq{$prefix}; - if (exists($ENV{'form.sortfield'}) && - $ENV{'form.sortfield'} !~ /^(default| + if (exists($env{'form.sortfield'}) && + $env{'form.sortfield'} !~ /^(default| author| url| title| owner| lastrevisiondate| copyright)$/x) { - my $tmp = $values{$ENV{'form.sortfield'}}; + my $tmp = $values{$env{'form.sortfield'}}; if (! defined($tmp)) { $tmp = 'undefined'; } $result .= ' '.$tmp.' '; } @@ -3450,9 +3382,9 @@ sub compact_view { my ($prefix,%values) = @_; my $result = $prefix.''; - if (exists($ENV{'form.sortfield'}) && - $ENV{'form.sortfield'} !~ /^(default|author|url|title)$/) { - my $tmp = $values{$ENV{'form.sortfield'}}; + if (exists($env{'form.sortfield'}) && + $env{'form.sortfield'} !~ /^(default|author|url|title)$/) { + my $tmp = $values{$env{'form.sortfield'}}; if (! defined($tmp)) { $tmp = 'undefined'; } $result .= ' '.$tmp.' '; }