use Digest::MD5 qw/md5_hex/;
use Apache2::Const -compile => qw/OK/;
use MARC::Record;
+use List::Util qw/first/;
#use Data::Dumper;
#$Data::Dumper::Indent = 0;
# XXX TODO add config.global_flag rows for browse limit-limit and
# browse offset-limit?
- my $limit = int($self->cgi->param('blimit') || 10);
+ my $limit = int(
+ $self->cgi->param('blimit') ||
+ $self->ctx->{opac_hits_per_page} ||
+ 10
+ );
my $offset = int($self->cgi->param('boffset') || 0);
my $force_backward = scalar($self->cgi->param('bback'));
if ($map->{$qtype}) {
if ($bterm =~ qr/$map->{$qtype}/i) {
$self->ctx->{browse_leading_article_warning} = 1;
+ ($self->ctx->{browse_leading_article_alternative} = $bterm) =~
+ s/$map->{$qtype}//;
}
}
};
_init_browse_cache();
+ # This is just so we can access a user settings IFF the user is logged in
+ # (opac.hits_per_page).
+ if ($self->ctx->{user}) {
+ $self->prepare_extended_user_info('settings');
+ if (my $setting = first { $_->name eq 'opac.hits_per_page' }
+ @{$self->ctx->{user}->settings}) {
+
+ $self->ctx->{opac_hits_per_page} = $setting->value;
+ }
+ }
+
+
$self->ctx->{more_forward} = 0;
$self->ctx->{more_back} = 0;
INCLUDE "opac/parts/topnav.tt2";
ctx.page_title = l("Browse the Catalog");
- blimit = CGI.param('blimit') || 10;
+ blimit = CGI.param('blimit') || ctx.opac_hits_per_page || 10;
boffset = CGI.param('boffset') || 0;
depart_list = ['blimit', 'bterm', 'boffset', 'bpivot', 'bback'];
<div id="main-content">
<div id="browse-the-catalog">
<div id="browse-controls">
- <form method="get">
+ <form method="get" onsubmit="$('browse-submit-spinner').className = ''; return true">
<input type="hidden" name="blimit"
value="[% blimit %]" />
[% control_qtype = INCLUDE "opac/parts/qtype_selector.tt2"
- id="browse-search-class" browse_only=1 %]
+ id="browse-search-class" browse_only=1 plural=1 %]
[% control_bterm = BLOCK %]<input type="text" name="bterm" id="browse-term"
value="[% CGI.param('bterm') | html %]" />[% END %]
[% control_locg = INCLUDE build_org_selector id='browse-context'
show_loc_groups=1
arialabel=l('Select holding library') %]
- [% l('Browse by [_1] for [_2] held under [_3]', control_qtype, control_bterm, control_locg) %]
+ [% l('Browse for [_1] starting with [_2] in [_3]', control_qtype, control_bterm, control_locg) %]
<input type="submit" value="[% l('Go') %]" />
+ <img id="browse-submit-spinner" src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif" class="hidden" style="width: 16px; height: 16px;" alt="" />
</form>
</div>
[% BLOCK browse_pager %]
<div class="browse-pager">
[% IF ctx.more_back %]
- <a class="opac-button" href="[% mkurl('', {bpivot => ctx.back_pivot, bback => 1}) %]">← [%l ('Back') %]</a>
+ <a class="opac-button" href="[% mkurl('', {bpivot => ctx.back_pivot, bback => 1}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">← [%l ('Back') %]</a>
[% END %]
[% IF browse.english_pager; # XXX how to apply i18n here?
current_qtype = CGI.param('qtype') || 'title' %]
[% END %]
[% IF ctx.more_forward %]
- <a class="opac-button" href="[% mkurl('', {bpivot => ctx.forward_pivot}, ['bback']) %]">[%l ('Forward') %] →</a>
+ <a class="opac-button" href="[% mkurl('', {bpivot => ctx.forward_pivot}, ['bback']) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">[%l ('Next') %] →</a>
[% END %]
+
+ <img id="browse-pager-spinner-[% id %]" src="[% ctx.media_prefix %]/opac/images/progressbar_green.gif" class="hidden" style="width: 16px; height: 16px;" alt="" />
</div>
[% END %]
- [% PROCESS browse_pager %]
+ [% PROCESS browse_pager id=0 %]
<div id="browse-results">
[% IF ctx.browse_error %]
[% ELSE %]
[% IF ctx.browse_leading_article_warning %]
<div class="browse-leading-article-warning">
- [% l("Your browse term seems to begin with an article. You might get better results by omitting the article.") %]
+ [% l("Your browse term seems to begin with an article (a, an, the). You might get better results by omitting the article.") %]
+ [% IF ctx.browse_leading_article_alternative %]
+ <p>
+ [% alternative_link = BLOCK %]
+ <a href="[% mkurl('', {bterm => ctx.browse_leading_article_alternative}, ['bback','bpivot','boffest']) %]">[% ctx.browse_leading_article_alternative | html %]</a>
+ [% END; # alternative_link BLOCK
+ l("Did you mean [_1]?", alternative_link);
+ END # IF %]
+ </p >
</div>
[% END %]
- <ul class="browse-result-list">
+
+ <ol class="browse-result-list">
[% FOR result IN ctx.browse_results %]
<li class="browse-result">
<span class="browse-result-value">
[% END %]
</div>
- [% PROCESS browse_pager %]
+ [% PROCESS browse_pager id=1 %]
</div>
<div class="common-full-pad"></div>
[% query_types = [
{value => "keyword", label => l("Keyword")},
- {value => "title", label => l("Title"), browse => 1},
+ {value => "title", label => l("Title"), plural_label => l("Titles"), browse => 1},
{value => "jtitle", label => l("Journal Title")},
- {value => "author", label => l("Author"), browse => 1},
- {value => "subject", label => l("Subject"), browse => 1},
- {value => "series", label => l("Series"), browse => 1},
+ {value => "author", label => l("Author"), plural_label => l("Authors"), browse => 1},
+ {value => "subject", label => l("Subject"), plural_label => l("Subjects"), browse => 1},
+ {value => "series", label => l("Series"), plural_label => l("Series"), browse => 1},
{value => "id|bibcn", label => l("Bib Call Number")}
] %]
<select name="[% name || 'qtype' %]"[% IF id; ' id="'; id ; '"' ; END -%]
NEXT IF browse_only AND NOT qt.browse -%]
<option value='[% qt.value | html %]'[%
query_type == qt.value ? ' selected="selected"' : ''
- %]>[% qt.label | html %]</option>
+ %]>[% IF plural AND qt.plural_label;
+ qt.plural_label | html;
+ ELSE;
+ qt.label | html;
+ END %]</option>
[% END -%]
</select>