View | Details | Raw Unified | Return to bug 9458
Collapse All | Expand All

(-)a/C4/VirtualShelves.pm (-1 / +1 lines)
Lines 277-283 sub GetShelfContents { Link Here
277
    my @params = ($shelfnumber);
277
    my @params = ($shelfnumber);
278
    if($sortfield) {
278
    if($sortfield) {
279
        $query .= " ORDER BY " . $sortfield;
279
        $query .= " ORDER BY " . $sortfield;
280
        $query .= " DESC " if ( ( $sortfield eq 'copyrightdate' ) || ( $sort_direction eq 'desc' ) );
280
        $query .= " DESC " if ( $sort_direction eq 'desc' );
281
    }
281
    }
282
    if($row_count){
282
    if($row_count){
283
       $query .= " LIMIT ?, ? ";
283
       $query .= " LIMIT ?, ? ";
(-)a/C4/VirtualShelves/Page.pm (-4 / +6 lines)
Lines 249-256 sub shelfpage { Link Here
249
                my $items;
249
                my $items;
250
                my $tag_quantity;
250
                my $tag_quantity;
251
                my $sortfield = ( $sorton ? $sorton : 'title' );
251
                my $sortfield = ( $sorton ? $sorton : 'title' );
252
                $sortfield = $query->param('sort') || $sortfield; ## Passed in sorting overrides default sorting
252
                $sortfield = $query->param('sort') || $sortfield || 'title'; ## Passed in sorting overrides default sorting
253
                my $direction = $query->param('direction');
253
                my $direction = $query->param('direction') || 'asc';
254
                $template->param(
255
                    sort      => $sortfield,
256
                    direction => $direction,
257
                );
254
                ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction );
258
                ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction );
255
                for my $this_item (@$items) {
259
                for my $this_item (@$items) {
256
                    my $biblionumber = $this_item->{'biblionumber'};
260
                    my $biblionumber = $this_item->{'biblionumber'};
Lines 461-468 sub shelfpage { Link Here
461
            barshelvesloop => $barshelves,
465
            barshelvesloop => $barshelves,
462
            pubshelves     => $total->{pubtotal},
466
            pubshelves     => $total->{pubtotal},
463
            pubshelvesloop => $pubshelves,
467
            pubshelvesloop => $pubshelves,
464
            sort           => $query->param('sort'),
465
            direction      => $query->param('direction'),
466
    );
468
    );
467
469
468
    output_html_with_http_headers $query, $cookie, $template->output;
470
    output_html_with_http_headers $query, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt (-4 / +10 lines)
Lines 204-210 function placeHold () { Link Here
204
     <span class="clearall"></span></p>
204
     <span class="clearall"></span></p>
205
 [% END %]
205
 [% END %]
206
	
206
	
207
 [% IF direction == 'asc' %][% direction = 'desc' %][% ELSE %][% direction = 'asc' %][% END %]
207
 [% IF direction == 'asc' %][% SET new_direction = 'desc' %][% ELSE %][% SET new_direction = 'asc' %][% END %]
208
 <div class="pages">[% pagination_bar %]</div>
208
 <div class="pages">[% pagination_bar %]</div>
209
    <table>
209
    <table>
210
            <tr>
210
            <tr>
Lines 212-245 function placeHold () { Link Here
212
212
213
                [% UNLESS ( item_level_itypes ) %]<th>Item type</th>[% END %]
213
                [% UNLESS ( item_level_itypes ) %]<th>Item type</th>[% END %]
214
                <th>
214
                <th>
215
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=title&direction=[% direction %]">Title</a>
215
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=title&direction=[% new_direction %]">Title</a>
216
                    [% IF sort == 'title' %]
216
                    [% IF sort == 'title' %]
217
                        [% IF direction == 'asc' %]
217
                        [% IF direction == 'asc' %]
218
                            <img src="/intranet-tmpl/prog/img/asc.gif" />
218
                            <img src="/intranet-tmpl/prog/img/asc.gif" />
219
                        [% ELSIF direction == 'desc' %]
219
                        [% ELSIF direction == 'desc' %]
220
                            <img src="/intranet-tmpl/prog/img/desc.gif" />
220
                            <img src="/intranet-tmpl/prog/img/desc.gif" />
221
                        [% END %]
221
                        [% END %]
222
                    [% ELSE %]
223
                        <img src="/intranet-tmpl/prog/img/ascdesc.gif" />
222
                    [% END %]
224
                    [% END %]
223
                </th>
225
                </th>
224
                <th>
226
                <th>
225
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=author&direction=[% direction %]">Author</a>
227
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=author&direction=[% new_direction %]">Author</a>
226
                   [% IF sort == 'author' %]
228
                   [% IF sort == 'author' %]
227
                        [% IF direction == 'asc' %]
229
                        [% IF direction == 'asc' %]
228
                            <img src="/intranet-tmpl/prog/img/asc.gif" />
230
                            <img src="/intranet-tmpl/prog/img/asc.gif" />
229
                        [% ELSIF direction == 'desc' %]
231
                        [% ELSIF direction == 'desc' %]
230
                            <img src="/intranet-tmpl/prog/img/desc.gif" />
232
                            <img src="/intranet-tmpl/prog/img/desc.gif" />
231
                        [% END %]
233
                        [% END %]
234
                    [% ELSE %]
235
                        <img src="/intranet-tmpl/prog/img/ascdesc.gif" />
232
                    [% END %]
236
                    [% END %]
233
                 </th>
237
                 </th>
234
                <th>Date added</th>
238
                <th>Date added</th>
235
                <th>
239
                <th>
236
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=itemcallnumber&direction=[% direction %]">Call number</a>
240
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=itemcallnumber&direction=[% new_direction %]">Call number</a>
237
                   [% IF sort == 'itemcallnumber' %]
241
                   [% IF sort == 'itemcallnumber' %]
238
                        [% IF direction == 'asc' %]
242
                        [% IF direction == 'asc' %]
239
                            <img src="/intranet-tmpl/prog/img/asc.gif" />
243
                            <img src="/intranet-tmpl/prog/img/asc.gif" />
240
                        [% ELSIF direction == 'desc' %]
244
                        [% ELSIF direction == 'desc' %]
241
                            <img src="/intranet-tmpl/prog/img/desc.gif" />
245
                            <img src="/intranet-tmpl/prog/img/desc.gif" />
242
                        [% END %]
246
                        [% END %]
247
                    [% ELSE %]
248
                        <img src="/intranet-tmpl/prog/img/ascdesc.gif" />
243
                    [% END %]
249
                    [% END %]
244
                 </th>
250
                 </th>
245
                <th>&nbsp;</th>
251
                <th>&nbsp;</th>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt (-2 / +21 lines)
Lines 317-324 $(document).ready(function() { Link Here
317
            <option value="itemcallnumber">Call number</option>
317
            <option value="itemcallnumber">Call number</option>
318
        [% END %]
318
        [% END %]
319
319
320
        <input type="submit" id="sort-submit" value="Resort list" />
320
        [% IF sort == 'copyrightdate' %]
321
            <option value="copyrightdate" selected="selected">Copyright date</option>
322
        [% ELSE %]
323
            <option value="copyrightdate">Copyright date</option>
324
        [% END %]
325
    </select>
326
327
    <select name="direction" onchange="$('#sorting-form').submit()">
328
        [% IF direction == 'asc' %]
329
            <option value="asc" selected="selected">Ascending</option>
330
        [% ELSE %]
331
            <option value="asc">Ascending</option>
332
        [% END %]
333
334
        [% IF direction == 'desc' %]
335
            <option value="desc" selected="selected">Descending</option>
336
        [% ELSE %]
337
            <option value="desc">Descending</option>
338
        [% END %]
321
    </select>
339
    </select>
340
341
    <input type="submit" id="sort-submit" value="Resort list" />
322
</form>
342
</form>
323
343
324
                [% IF ( manageshelf ) %] <span class="sep">|</span> <form method="get" action="opac-shelves.pl"><input type="hidden" name="op" value="modif" />
344
                [% IF ( manageshelf ) %] <span class="sep">|</span> <form method="get" action="opac-shelves.pl"><input type="hidden" name="op" value="modif" />
325
- 

Return to bug 9458