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

(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 411-413 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
411
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');
411
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');
412
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');
412
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');
413
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');
413
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');
414
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo');
415
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch''s items to emphasize. If PatronBranch, emphasize the logged in user''s library''s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha''s Apache configuration file.','Choice')
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 6399-6404 if ( CheckVersion($DBversion) ) { Link Here
6399
    SetVersion($DBversion);
6399
    SetVersion($DBversion);
6400
}
6400
}
6401
6401
6402
$DBversion = "3.11.00.XXX";
6403
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6404
    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo')");
6405
    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch''s items to emphasize. If PatronBranch, emphasize the logged in user''s library''s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha''s Apache configuration file.','Choice')");
6406
    print "Upgrade to $DBversion done (Add syspref HighlightOwnItemsOnOPAC)\n";
6407
    SetVersion ($DBversion);
6408
}
6402
6409
6403
=head1 FUNCTIONS
6410
=head1 FUNCTIONS
6404
6411
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+11 lines)
Lines 22-27 OPAC: Link Here
22
                  no: Disable
22
                  no: Disable
23
            - "Koha OPAC as public. Private OPAC requires authentification before accessing the OPAC."
23
            - "Koha OPAC as public. Private OPAC requires authentification before accessing the OPAC."
24
        -
24
        -
25
            - pref: HighlightOwnItemsOnOPAC
26
              choices:
27
                  yes: Emphasize
28
                  no: "Don't emphasize"
29
            - "results from the "
30
            - pref: HighlightOwnItemsOnOPACWhich
31
              choices:
32
                  PatronBranch: "patron's home branch"
33
                  OpacURLBranch: "OPAC's branch via the URL"
34
            - " by moving the results to the front and increasing the size or highlighting the rows for those results."
35
        -
25
            - "Show star-ratings on"
36
            - "Show star-ratings on"
26
            - pref: OpacStarRatings
37
            - pref: OpacStarRatings
27
              choices:
38
              choices:
(-)a/koha-tmpl/opac-tmpl/prog/en/css/opac.css (+8 lines)
Lines 2890-2892 a.reviewlink,a.reviewlink:visited { Link Here
2890
.idbresult img {
2890
.idbresult img {
2891
    padding-right: 6px;
2891
    padding-right: 6px;
2892
}
2892
}
2893
2894
.highlight-row-results {
2895
    font-size: 120%;
2896
}
2897
2898
.highlight-row-detail {
2899
    font-weight: bold;
2900
}
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (-1 / +2 lines)
Lines 1278-1284 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1278
        [% END %]
1278
        [% END %]
1279
        </tr></thead>
1279
        </tr></thead>
1280
	    <tbody>[% FOREACH ITEM_RESULT IN items %]
1280
	    <tbody>[% FOREACH ITEM_RESULT IN items %]
1281
      <tr>[% IF ( item_level_itypes ) %]<td class="itype">[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %]<img src="[% ITEM_RESULT.imageurl %]" title="[% ITEM_RESULT.description %]" alt="[% ITEM_RESULT.description %]" />[% END %][% END %] [% ITEM_RESULT.description %]</td>[% END %]
1281
      [% IF ITEM_RESULT.this_branch %]<tr class="highlight-row-detail">[% ELSE %]<tr>[% END %]
1282
      [% IF ( item_level_itypes ) %]<td class="itype">[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %]<img src="[% ITEM_RESULT.imageurl %]" title="[% ITEM_RESULT.description %]" alt="[% ITEM_RESULT.description %]" />[% END %][% END %] [% ITEM_RESULT.description %]</td>[% END %]
1282
             <td class="location">
1283
             <td class="location">
1283
    [% UNLESS ( singleBranchMode ) %]
1284
    [% UNLESS ( singleBranchMode ) %]
1284
        <span class="[% ITEM_RESULT.branch_opac_info ? 'branch-info-tooltip-trigger' : '' %]">
1285
        <span class="[% ITEM_RESULT.branch_opac_info ? 'branch-info-tooltip-trigger' : '' %]">
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt (+2 lines)
Lines 528-533 $(document).ready(function(){ Link Here
528
                    [% IF ( SEARCH_RESULT.available_items_loop.size() ) %]
528
                    [% IF ( SEARCH_RESULT.available_items_loop.size() ) %]
529
                    <span class="available"><strong>Copies available:</strong>
529
                    <span class="available"><strong>Copies available:</strong>
530
                    [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %]
530
                    [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %]
531
                    [% IF available_items_loo.this_branch %]<span class="highlight-row-results">[% ELSE %]<span>[% END %]
531
                    [% IF ( singleBranchMode ) %]
532
                    [% IF ( singleBranchMode ) %]
532
                        [% available_items_loo.location %]
533
                        [% available_items_loo.location %]
533
                    [% ELSE %]
534
                    [% ELSE %]
Lines 539-544 $(document).ready(function(){ Link Here
539
                        [% IF ( available_items_loo.itemcallnumber ) %][<a href="/cgi-bin/koha/opac-search.pl?q=callnum:[% available_items_loo.itemcallnumber |url %]">[% available_items_loo.itemcallnumber %]</a>][% END %]
540
                        [% IF ( available_items_loo.itemcallnumber ) %][<a href="/cgi-bin/koha/opac-search.pl?q=callnum:[% available_items_loo.itemcallnumber |url %]">[% available_items_loo.itemcallnumber %]</a>][% END %]
540
                    [% END %]
541
                    [% END %]
541
                    ([% available_items_loo.count %]),
542
                    ([% available_items_loo.count %]),
543
                    </span>
542
                    [% END %]
544
                    [% END %]
543
                    </span>
545
                    </span>
544
                    [% ELSE %]
546
                    [% ELSE %]
(-)a/opac/opac-detail.pl (+32 lines)
Lines 441-446 if ($hideitems) { Link Here
441
    @items = @all_items;
441
    @items = @all_items;
442
}
442
}
443
443
444
my $branches = GetBranches();
445
my $branch = C4::Context->userenv->{branch};
446
if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
447
    if (
448
        ( ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch )
449
        ||
450
        C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch'
451
    ) {
452
        my $branchname;
453
        if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) {
454
            $branchname = $branches->{$branch}->{'branchname'};
455
        }
456
        elsif (  C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) {
457
            $branchname = $branches->{ $ENV{'BRANCHCODE'} }->{'branchname'};
458
        }
459
460
        my @our_items;
461
        my @other_items;
462
463
        foreach my $item ( @items ) {
464
           if ( $item->{'branchname'} eq $branchname ) {
465
               $item->{'this_branch'} = 1;
466
               push( @our_items, $item );
467
           } else {
468
               push( @other_items, $item );
469
           }
470
        }
471
472
        @items = ( @our_items, @other_items );
473
    }
474
}
475
444
my $dat = &GetBiblioData($biblionumber);
476
my $dat = &GetBiblioData($biblionumber);
445
477
446
my $itemtypes = GetItemTypes();
478
my $itemtypes = GetItemTypes();
(-)a/opac/opac-search.pl (-1 / +34 lines)
Lines 693-698 for (my $i=0;$i<@servers;$i++) { Link Here
693
            $template->param(results_per_page =>  $results_per_page);
693
            $template->param(results_per_page =>  $results_per_page);
694
            my $hide = C4::Context->preference('OpacHiddenItems');
694
            my $hide = C4::Context->preference('OpacHiddenItems');
695
            $hide = ($hide =~ m/\S/) if $hide; # Just in case it has some spaces/new lines
695
            $hide = ($hide =~ m/\S/) if $hide; # Just in case it has some spaces/new lines
696
697
            my $branch = C4::Context->userenv->{branch};
698
            if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
699
                if (
700
                    ( ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch )
701
                    ||
702
                    C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch'
703
                ) {
704
                    my $branchname;
705
                    if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) {
706
                        $branchname = $branches->{$branch}->{'branchname'};
707
                    }
708
                    elsif (  C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) {
709
                        $branchname = $branches->{ $ENV{'BRANCHCODE'} }->{'branchname'};
710
                    }
711
712
                    foreach my $res ( @newresults ) {
713
                        my @new_loop;
714
                        my @top_loop;
715
                        my @old_loop = @{$res->{'available_items_loop'}};
716
                        foreach my $item ( @old_loop ) {
717
                            if ( $item->{'branchname'} eq $branchname ) {
718
                                $item->{'this_branch'} = 1;
719
                                push( @top_loop, $item );
720
                            } else {
721
                                push( @new_loop, $item );
722
                            }
723
                        }
724
                        my @complete_loop = ( @top_loop, @new_loop );
725
                        $res->{'available_items_loop'} = \@complete_loop;
726
                    }
727
                }
728
            }
729
696
            $template->param(
730
            $template->param(
697
                SEARCH_RESULTS => \@newresults,
731
                SEARCH_RESULTS => \@newresults,
698
                OPACItemsResultsDisplay => (C4::Context->preference("OPACItemsResultsDisplay")),
732
                OPACItemsResultsDisplay => (C4::Context->preference("OPACItemsResultsDisplay")),
699
- 

Return to bug 7740