From 973f84513f980722c2a5a30e9d7c8dd04f3af0ee Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Fri, 27 Jan 2012 16:59:27 +1300 Subject: [PATCH] bug_7140: Added item description to complement icon to search result and biblio detail pages Signed-off-by: Jared Camins-Esakov This seems like a very big improvement, especially for people using screen readers. I agree that the change to C4::Search is required. Signed-off-by: Paul Poulain --- C4/Search.pm | 5 +- .../prog/en/modules/catalogue/detail.tt | 14 ++-- .../prog/en/modules/catalogue/results.tt | 69 ++++++++++++------- 3 files changed, 54 insertions(+), 34 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index f994e9a90a..7adb6254d6 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1619,6 +1619,7 @@ sub searchResults { foreach my $code ( keys %subfieldstosearch ) { $item->{$code} = $field->subfield( $subfieldstosearch{$code} ); } + $item->{description} = $itemtypes{ $item->{itype} }{description}; # Hidden items if ($is_opac) { @@ -1649,6 +1650,7 @@ sub searchResults { $onloan_items->{$key}->{branchname} = $item->{branchname}; $onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} }; $onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; + $onloan_items->{$key}->{description} = $item->{description}; $onloan_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); # if something's checked out and lost, mark it as 'long overdue' if ( $item->{itemlost} ) { @@ -1733,6 +1735,7 @@ sub searchResults { $other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value; $other_items->{$key}->{count}++ if $item->{$hbranch}; $other_items->{$key}->{location} = $shelflocations->{ $item->{location} }; + $other_items->{$key}->{description} = $item->{description}; $other_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); } # item is available @@ -1740,7 +1743,7 @@ sub searchResults { $can_place_holds = 1; $available_count++; $available_items->{$prefix}->{count}++ if $item->{$hbranch}; - foreach (qw(branchname itemcallnumber hideatopac)) { + foreach (qw(branchname itemcallnumber hideatopac description)) { $available_items->{$prefix}->{$_} = $item->{$_}; } $available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 858c2d6d52..4bea1118c8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -288,16 +288,12 @@ function verify_images() { [% FOREACH itemloo IN itemloop %] [% IF ( item_level_itypes ) %] - - [% IF ( noItemTypeImages ) %] - [% itemloo.description %] - [% ELSE %] - [% IF ( itemloo.imageurl ) %] + + [% IF !noItemTypeImages && itemloo.imageurl %] [% itemloo.description %] - [% ELSE %] - [% itemloo.description %] - [% END %] - [% END %] + [% END %] + [% itemloo.description %] + [% END %] [% UNLESS ( singlebranchmode ) %][% itemloo.branchname %] [% END %] [% itemloo.homebranch %][% itemloo.location %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 50c842ed2b..783090214e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -475,17 +475,18 @@ YAHOO.util.Event.onContentReady("searchheader", function () { [% END %]

[% UNLESS ( item_level_itypes ) %] - [% UNLESS ( noItemTypeImages ) %][% IF ( SEARCH_RESULT.imageurl ) %] - - [% END %][% END %] + [% IF !noItemTypeImages && SEARCH_RESULT.imageurl %] + [% SEARCH_RESULT.description %] + [% END %] + [% SEARCH_RESULT.description %] [% END %] [% SEARCH_RESULT.summary %]

[% ELSE %]

[% UNLESS ( item_level_itypes ) %] - [% UNLESS ( noItemTypeImages ) %][% IF ( SEARCH_RESULT.imageurl ) %] + [% IF !noItemTypeImages && SEARCH_RESULT.imageurl %] - [% END %][% END %] + [% END %] [% END %] [% IF ( SEARCH_RESULT.author ) %] @@ -537,41 +538,56 @@ YAHOO.util.Event.onContentReady("searchheader", function () {

    [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %] - [% IF ( noItemTypeImages ) %]
  • [% ELSE %][% IF ( item_level_itypes ) %][% IF ( available_items_loo.imageurl ) %]
  • [% available_items_loo.description %][% ELSE %]
  • [% END %][% ELSE %]
  • [% END %][% END %] + [% IF item_level_itypes && !noItemTypeImages && available_items_loo.imageurl %] +
  • + [% available_items_loo.description %] + [% ELSE %] +
  • + [% END %] [% IF ( available_items_loo.branchname ) %][% available_items_loo.branchname %][% END %] [% IF ( available_items_loo.location ) %][% available_items_loo.location %][% END %] [% IF ( available_items_loo.itemcallnumber ) %][[% available_items_loo.itemcallnumber %]][% END %] - ([% available_items_loo.count %])
  • - [% END %]
+ ([% available_items_loo.count %]) + [% IF item_level_itypes && available_items_loo.description %] +
[% available_items_loo.description %] + [% END %] + + [% END %] + [% END %] [% IF ( SEARCH_RESULT.onloancount ) %] [% SEARCH_RESULT.onloancount %] on loan:
    [% FOREACH onloan_items_loo IN SEARCH_RESULT.onloan_items_loop %] - [% IF ( noItemTypeImages ) %]
  • [% ELSE %][% IF ( item_level_itypes ) %] - [% IF ( onloan_items_loo.imageurl ) %] -
  • [% onloan_items_loo.description %] - [% ELSE %]
  • [% END %] - [% ELSE %]
  • [% END %][% END %] - + [% IF item_level_itypes && !noItemTypeImages && onloan_items_loo.imageurl %] +
  • + [% onloan_items_loo.description %] + [% ELSE %] +
  • + [% END %] [% IF ( onloan_items_loo.branchname ) %][% onloan_items_loo.branchname %][% END %] [% IF ( onloan_items_loo.location ) %][% onloan_items_loo.location %][% END %] [% IF ( onloan_items_loo.itemcallnumber ) %][[% onloan_items_loo.itemcallnumber %]][% END %] - ([% onloan_items_loo.count %][% IF ( onloan_items_loo.longoverdue ) %], [% onloan_items_loo.longoverdue %] long overdue[% END %]) date due: [% onloan_items_loo.due_date %]
  • - [% END %]
+ ([% onloan_items_loo.count %][% IF ( onloan_items_loo.longoverdue ) %], [% onloan_items_loo.longoverdue %] long overdue[% END %]) date due: [% onloan_items_loo.due_date %] + [% IF item_level_itypes && onloan_items_loo.description %] +
[% onloan_items_loo.description %] + [% END %] + + [% END %] + [% END %] [% IF ( SEARCH_RESULT.othercount ) %] [% SEARCH_RESULT.othercount %] unavailable:
    [% FOREACH other_items_loo IN SEARCH_RESULT.other_items_loop %] - [% IF ( noItemTypeImages ) %]
  • [% ELSE %][% IF ( item_level_itypes ) %] - [% IF ( other_items_loo.imageurl ) %] -
  • [% other_items_loo.description %] - [% ELSE %]
  • [% END %] - [% ELSE %]
  • [% END %][% END %] - + [% IF item_level_itypes && !noItemTypeImages && other_items_loo.imageurl %] +
  • + [% other_items_loo.description %] + [% ELSE %] +
  • + [% END %] [% IF ( other_items_loo.branchname ) %][% other_items_loo.branchname %][% END %] [% IF ( other_items_loo.location ) %][% other_items_loo.location %][% END %] [% IF ( other_items_loo.itemcallnumber ) %][[% other_items_loo.itemcallnumber %]][% END %] @@ -581,8 +597,13 @@ YAHOO.util.Event.onContentReady("searchheader", function () { [% IF ( other_items_loo.intransit ) %](In transit)[% END %] [% IF ( other_items_loo.onhold ) %](On hold)[% END %] [% IF ( other_items_loo.notforloan ) %][% other_items_loo.notforloan %][% END %] - ([% other_items_loo.count %])
  • - [% END %]
+ ([% other_items_loo.count %]) + [% IF item_level_itypes && other_items_loo.description %] +
[% other_items_loo.description %] + [% END %] + + [% END %] + [% END %] [% ELSE %] [% IF ( SEARCH_RESULT.ALTERNATEHOLDINGS.count ) %] -- 2.20.1