return $self->redirect_ssl unless $self->cgi->https;
}
+ # XXX Cache this? Makes testing difficult as apache needs a restart.
+ my $default_sort = $e->retrieve_config_global_flag('opac.default_sort');
+ $ctx->{default_sort} =
+ ($default_sort && $U->is_true($default_sort->enabled)) ? $default_sort->value : '';
+
$ctx->{referer} = $self->cgi->referer;
$ctx->{path_info} = $self->cgi->path_info;
$ctx->{full_path} = $ctx->{base_path} . $self->cgi->path_info;
TRUE
);
+/* To be added when upgrade scripts are pulled into the baseline
+INSERT INTO config.global_flag (name, label, value, enabled) VALUES (
+ 'opac.default_sort',
+ oils_i18n_gettext(
+ 'opac.default_sort',
+ 'OPAC Default Sort (titlesort, authorsort, pubdate, popularity, poprel, or empty)',
+ 'cgf',
+ 'label'
+ ),
+ '',
+ TRUE
+);
+*/
+
INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
VALUES (
'history.circ.retention_age',
CREATE SCHEMA rating;
+INSERT INTO config.global_flag (name, label, value, enabled) VALUES (
+ 'opac.default_sort',
+ 'OPAC Default Sort (titlesort, authorsort, pubdate, popularity, poprel, or empty for relevance)',
+ '',
+ TRUE
+);
+
CREATE TABLE rating.popularity_parameter (
id INT PRIMARY KEY,
name TEXT NOT NULL UNIQUE, -- i18n
[% END %]
[%
CASE "sort_selector";
+ default_sort=ctx.default_sort;
+ IF CGI.param('sort');
+ default_sort=CGI.param('sort');
+ END;
INCLUDE "opac/parts/filtersort.tt2"
id=adv_chunk.id
- value=CGI.param('sort') class='results_header_sel';
+ value=default_sort class='results_header_sel';
%]
[% IF NOT metarecords.disabled %]
<option value='pubdate.descending'[% value == 'pubdate.descending' ? ' selected="selected"' : '' %]>[% l("Date: Newest to Oldest") %]</option>
<option value='pubdate'[% value == 'pubdate' ? ' selected="selected"' : '' %]>[% l("Date: Oldest to Newest") %]</option>
</optgroup>
+ <optgroup label='[% l("Sort by Popularity") %]'>
+ <option value='popularity'[% value == 'popularity' ? ' selected="selected"' : '' %]>[% l("Most Popular") %]</option>
+<!-- Sorting by least popular items first is probably not an expected
+ choice in production, but could be useful in cases where every
+ record has at least one badge value assigned and you want
+ to investigate the long tail.
+-->
+<!--
+ <option value='popularity.descending'[% value == 'popularity.descending' ? ' selected="selected"' : '' %]>[% l("Least Popular") %]</option>
+-->
+ <option value='poprel'[% value == 'poprel' ? ' selected="selected"' : '' %]>[% l("Popularity Adjusted Relevance") %]</option>
+ </optgroup>
</select>
[% END %]
</div>
[%- END %]
- [% UNLESS took_care_of_form %]</form>[% END %]
+ [% UNLESS took_care_of_form %]
+ [% IF ctx.default_sort %]
+ <input type="hidden" name="sort" value="[% ctx.default_sort %]"/>
+ [% END %]
+ </form>
+ [% END %]
[% IF (is_advanced AND NOT is_special) AND CGI.param('qtype') %]
<div class="opac-auto-102">
[ <a href="[% mkurl(ctx.opac_root _ '/advanced') %]">[%