From d3df15daa8f5d23edf4b0bdacf76d31958eb1c8e 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 Content-Type: text/plain; charset="UTF-8" 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. --- 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 e86bb26..c1af9be 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1628,6 +1628,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) { @@ -1658,6 +1659,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} ) { @@ -1742,6 +1744,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 @@ -1749,7 +1752,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 162b12a..7525d37 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 1931227..34ea3e7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -470,17 +470,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 ) %] @@ -531,41 +532,56 @@ YAHOO.util.Event.onContentReady("searchheader", function () {

+ ([% 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: + ([% 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: + ([% 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 ) %] -- 1.7.2.5