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

(-)a/C4/VirtualShelves.pm (-1 / +2 lines)
Lines 255-261 from C4::Circulation. Link Here
255
=cut
255
=cut
256
256
257
sub GetShelfContents {
257
sub GetShelfContents {
258
    my ($shelfnumber, $row_count, $offset, $sortfield) = @_;
258
    my ($shelfnumber, $row_count, $offset, $sortfield, $sort_direction ) = @_;
259
    my $dbh=C4::Context->dbh();
259
    my $dbh=C4::Context->dbh();
260
    my $sth1 = $dbh->prepare("SELECT count(*) FROM virtualshelfcontents WHERE shelfnumber = ?");
260
    my $sth1 = $dbh->prepare("SELECT count(*) FROM virtualshelfcontents WHERE shelfnumber = ?");
261
    $sth1->execute($shelfnumber);
261
    $sth1->execute($shelfnumber);
Lines 277-282 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 ( uc($sort_direction) eq 'DESC' );
280
        $query .= " DESC " if ($sortfield eq 'copyrightdate');
281
        $query .= " DESC " if ($sortfield eq 'copyrightdate');
281
    }
282
    }
282
    if($row_count){
283
    if($row_count){
(-)a/C4/VirtualShelves/Page.pm (-2 / +6 lines)
Lines 249-255 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
                ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield );
252
                $sortfield = $query->param('sort') || $sortfield; ## Passed in sorting overrides default sorting
253
                my $direction = $query->param('direction');
254
                ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction );
253
                for my $this_item (@$items) {
255
                for my $this_item (@$items) {
254
                    my $biblionumber = $this_item->{'biblionumber'};
256
                    my $biblionumber = $this_item->{'biblionumber'};
255
                    my $record = GetMarcBiblio($biblionumber);
257
                    my $record = GetMarcBiblio($biblionumber);
Lines 419-425 sub shelfpage { Link Here
419
421
420
    my $url = $type eq 'opac' ? "/cgi-bin/koha/opac-shelves.pl" : "/cgi-bin/koha/virtualshelves/shelves.pl";
422
    my $url = $type eq 'opac' ? "/cgi-bin/koha/opac-shelves.pl" : "/cgi-bin/koha/virtualshelves/shelves.pl";
421
    my %qhash = ();
423
    my %qhash = ();
422
    foreach (qw(display viewshelf sortfield)) {
424
    foreach (qw(display viewshelf sortfield sort direction)) {
423
        $qhash{$_} = $query->param($_) if $query->param($_);
425
        $qhash{$_} = $query->param($_) if $query->param($_);
424
    }
426
    }
425
    ( scalar keys %qhash ) and $url .= '?' . join '&', map { "$_=$qhash{$_}" } keys %qhash;
427
    ( scalar keys %qhash ) and $url .= '?' . join '&', map { "$_=$qhash{$_}" } keys %qhash;
Lines 459-464 sub shelfpage { Link Here
459
            barshelvesloop => $barshelves,
461
            barshelvesloop => $barshelves,
460
            pubshelves     => $total->{pubtotal},
462
            pubshelves     => $total->{pubtotal},
461
            pubshelvesloop => $pubshelves,
463
            pubshelvesloop => $pubshelves,
464
            sort           => $query->param('sort'),
465
            direction      => $query->param('direction'),
462
    );
466
    );
463
467
464
    output_html_with_http_headers $query, $cookie, $template->output;
468
    output_html_with_http_headers $query, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt (-3 / +32 lines)
Lines 202-216 function placeHold () { Link Here
202
     <span class="clearall"></span></p>
202
     <span class="clearall"></span></p>
203
 [% END %]
203
 [% END %]
204
	
204
	
205
 [% IF direction == 'asc' %][% direction = 'desc' %][% ELSE %][% direction = 'asc' %][% END %]
205
 <div class="pages">[% pagination_bar %]</div>
206
 <div class="pages">[% pagination_bar %]</div>
206
    <table>
207
    <table>
207
            <tr>
208
            <tr>
208
                [% IF ( itemsloop ) %]<th class="checkall">&nbsp;</th>[% END %]
209
                [% IF ( itemsloop ) %]<th class="checkall">&nbsp;</th>[% END %]
210
209
                [% UNLESS ( item_level_itypes ) %]<th>Item type</th>[% END %]
211
                [% UNLESS ( item_level_itypes ) %]<th>Item type</th>[% END %]
210
                <th>Title</th>
212
                <th>
211
                <th>Author</th>
213
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=title&direction=[% direction %]">Title</a>
214
                    [% IF sort == 'title' %]
215
                        [% IF direction == 'asc' %]
216
                            <img src="/intranet-tmpl/prog/img/asc.gif" />
217
                        [% ELSIF direction == 'desc' %]
218
                            <img src="/intranet-tmpl/prog/img/desc.gif" />
219
                        [% END %]
220
                    [% END %]
221
                </th>
222
                <th>
223
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=author&direction=[% direction %]">Author</a>
224
                   [% IF sort == 'author' %]
225
                        [% IF direction == 'asc' %]
226
                            <img src="/intranet-tmpl/prog/img/asc.gif" />
227
                        [% ELSIF direction == 'desc' %]
228
                            <img src="/intranet-tmpl/prog/img/desc.gif" />
229
                        [% END %]
230
                    [% END %]
231
                 </th>
212
                <th>Date added</th>
232
                <th>Date added</th>
213
                <th>Call number</th>
233
                <th>
234
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&sort=itemcallnumber&direction=[% direction %]">Call number</a>
235
                   [% IF sort == 'itemcallnumber' %]
236
                        [% IF direction == 'asc' %]
237
                            <img src="/intranet-tmpl/prog/img/asc.gif" />
238
                        [% ELSIF direction == 'desc' %]
239
                            <img src="/intranet-tmpl/prog/img/desc.gif" />
240
                        [% END %]
241
                    [% END %]
242
                 </th>
214
                <th>&nbsp;</th>
243
                <th>&nbsp;</th>
215
            </tr>
244
            </tr>
216
		[% FOREACH itemsloo IN itemsloop %]
245
		[% FOREACH itemsloo IN itemsloop %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt (-1 / +34 lines)
Lines 188-193 $(function() { Link Here
188
			alert(alertString2);
188
			alert(alertString2);
189
		}
189
		}
190
	}
190
	}
191
192
$(document).ready(function() {
193
  $('#sort-submit').hide();
194
});
195
191
//]]>
196
//]]>
192
</script>
197
</script>
193
</head>
198
</head>
Lines 287-292 $(function() { Link Here
287
292
288
<a class="print" href="opac-shelves.pl" onclick="print(); return false;">Print list</a>
293
<a class="print" href="opac-shelves.pl" onclick="print(); return false;">Print list</a>
289
294
295
<form action="/cgi-bin/koha/opac-shelves.pl" id="sorting-form">
296
    <input type="hidden" name="viewshelf" value="[% shelfnumber %]" />
297
298
    <label for="sort">Sort by: </label>
299
    <select name="sort" onchange="$('#sorting-form').submit()">
300
        <option value="">Default sorting</option>
301
302
        [% IF sort == 'author' %]
303
            <option value="author" selected="selected">Author</option>
304
        [% ELSE %]
305
            <option value="author">Author</option>
306
        [% END %]
307
308
        [% IF sort == 'title' %]
309
            <option value="title" selected="selected">Title</option>
310
        [% ELSE %]
311
            <option value="title">Title</option>
312
        [% END %]
313
314
        [% IF sort == 'itemcallnumber' %]
315
            <option value="itemcallnumber" selected="selected">Call number</option>
316
        [% ELSE %]
317
            <option value="itemcallnumber">Call number</option>
318
        [% END %]
319
320
        <input type="submit" id="sort-submit" value="Resort list" />
321
    </select>
322
</form>
323
290
                [% IF ( manageshelf ) %] <span class="sep">|</span> <form method="get" action="opac-shelves.pl"><input type="hidden" name="op" value="modif" />
324
                [% IF ( manageshelf ) %] <span class="sep">|</span> <form method="get" action="opac-shelves.pl"><input type="hidden" name="op" value="modif" />
291
                <input type="hidden" name="display" value="viewshelf" />
325
                <input type="hidden" name="display" value="viewshelf" />
292
                <input type="hidden" name="shelfnumber" value="[% shelfnumber %]" /> <input type="submit" class="editshelf" value="Edit list" /></form>
326
                <input type="hidden" name="shelfnumber" value="[% shelfnumber %]" /> <input type="submit" class="editshelf" value="Edit list" /></form>
293
- 

Return to bug 9458