koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha C4/Search.pm koha-tmpl/opac-tmpl/npl/en/in... [dev_week]


From: Joshua Ferraro
Subject: [Koha-cvs] koha C4/Search.pm koha-tmpl/opac-tmpl/npl/en/in... [dev_week]
Date: Wed, 09 Aug 2006 23:59:21 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Joshua Ferraro <kados>  06/08/09 23:59:21

Modified files:
        C4             : Search.pm 
        koha-tmpl/opac-tmpl/npl/en/includes: navigation.inc 

Log message:
        quite a few cleanups of facets...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Search.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.99.2.11.2.20&r2=1.99.2.11.2.21
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/npl/en/includes/navigation.inc?cvsroot=koha&only_with_tag=dev_week&r1=1.2.2.4.2.12&r2=1.2.2.4.2.13

Patches:
Index: C4/Search.pm
===================================================================
RCS file: /sources/koha/koha/C4/Search.pm,v
retrieving revision 1.99.2.11.2.20
retrieving revision 1.99.2.11.2.21
diff -u -b -r1.99.2.11.2.20 -r1.99.2.11.2.21
--- C4/Search.pm        9 Aug 2006 22:59:30 -0000       1.99.2.11.2.20
+++ C4/Search.pm        9 Aug 2006 23:59:21 -0000       1.99.2.11.2.21
@@ -23,6 +23,7 @@
 use C4::Context;
 use C4::Reserves2;
 use C4::Biblio;
+use C4::Koha;
 use Date::Calc;
 use MARC::File::XML;
 use MARC::File::USMARC;
@@ -35,7 +36,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.99.2.11.2.20 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.99.2.11.2.21 $' =~ /\d+/g;
           shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -4095,7 +4096,7 @@
        # establish database connections
     my $dbh = C4::Context->dbh;
     my $zconn=C4::Context->Zconn("biblioserver");
-
+       my $branches = getbranches();
        # make sure all is well with the connection
     if ($zconn eq "error") {
         return("error with connection",undef); #FIXME: better error handling
@@ -4156,25 +4157,25 @@
        my $facets_counter = ();
        my $facets_info = ();
        my $facets = [ {
-               link_value => 'topic_facet',
+               link_value => 'su-t',
                label_value => 'Subject - Topic',
                tags => ['650', '651',],
                subfield => 'a',
                },
                {
-        link_value => 'author_facet',
+        link_value => 'au',
         label_value => 'Authors',
         tags => ['100','700',],
         subfield => 'a',
                },
                {
-        link_value => 'series_facet',
+        link_value => 'se',
         label_value => 'Series',
         tags => ['440','490',],
         subfield => 'a',
         },
                {
-        link_value => 'branch_facets',
+        link_value => 'branch',
         label_value => 'Branches',
         tags => ['952',],
         subfield => 'b',
@@ -4239,11 +4240,29 @@
                for my $one_facet (sort { $facets_counter->{ $link_value 
}->{$b} <=> $facets_counter->{ $link_value }->{$a} } keys %{$facets_counter->{ 
$link_value }} ) {
                        $number_of_facets++;
                        if (($number_of_facets < 6) || ($expanded_facet eq 
$link_value) || ($facets_info->{ $link_value }->{ 'expanded'})) {
-                               my $facet_linkvalue = $one_facet;
+
+                               # sanitize the link value ), ( will cause 
errors with CCL
+                               my $facet_link_value = $one_facet;
+                               $facet_link_value =~ s/(\(|\))/ /g;
+
+                               # fix the length that will display in the label
+                               my $facet_label_value = $one_facet;
+                               $facet_label_value = 
substr($one_facet,0,20)."..." unless length($facet_label_value)<=20;
+                               # well, if it's a branch, label by the name, 
not the code
+                               if ($link_value =~/branch/) {
+                                       warn "branch";
+                                       $facet_label_value = 
$branches->{$one_facet}->{'branchname'};
+                               }
+                               
+                               # but we're down with the whole label being in 
the link's title
+                               my $facet_title_value = $one_facet;
+
                                push @this_facets_array , 
                                ( { facet_count => $facets_counter->{ 
$link_value }->{ $one_facet }, 
-                                       facet_labelvalue => $one_facet, 
-                                       facet_linkvalue => $facet_linkvalue
+                                       facet_label_value => $facet_label_value,
+                                       facet_title_value => $facet_title_value,
+                                       facet_link_value => $facet_link_value,
+                                       type_link_value => $link_value,
                                        },
                                );
                                }
@@ -4252,8 +4271,9 @@
                        $expandable=1 if (($number_of_facets > 6) && 
($expanded_facet ne $link_value));
                }
                push @facets_loop, 
-               ( {     link_value => $link_value,
-                       label_value  => $facets_info->{ $link_value }->{ 
'label_value' },
+               ( {     type_link_value => $link_value,
+                       type_id => $link_value."_id",
+                       type_label  => $facets_info->{ $link_value }->{ 
'label_value' },
                        facets => address@hidden,
                        expandable => $expandable,
                        expand => $link_value,

Index: koha-tmpl/opac-tmpl/npl/en/includes/navigation.inc
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/opac-tmpl/npl/en/includes/navigation.inc,v
retrieving revision 1.2.2.4.2.12
retrieving revision 1.2.2.4.2.13
diff -u -b -r1.2.2.4.2.12 -r1.2.2.4.2.13
--- koha-tmpl/opac-tmpl/npl/en/includes/navigation.inc  9 Aug 2006 22:59:30 
-0000       1.2.2.4.2.12
+++ koha-tmpl/opac-tmpl/npl/en/includes/navigation.inc  9 Aug 2006 23:59:21 
-0000       1.2.2.4.2.13
@@ -5,12 +5,12 @@
 <h6>Refine Your Search</h6>
 <ul id="facets">
 <!-- TMPL_LOOP NAME="facets_loop" -->
-<li id="<!-- TMPL_VAR NAME="link_value" -->"><!-- TMPL_VAR NAME="label_value" 
--><ul>
+<li id="<!-- TMPL_VAR NAME="type_id" -->"><!-- TMPL_VAR NAME="type_label" 
--><ul>
        <!-- TMPL_LOOP NAME="facets" -->
-               <li><a href="<!-- TMPL_VAR NAME="facet_linkvalue" -->"><!-- 
TMPL_VAR NAME="facet_labelvalue" --></a> (<!-- TMPL_VAR NAME="facet_count" 
-->)</li>
+               <li><a href="/search?q=<!-- TMPL_VAR NAME="searchdesc" 
-->&q=<!-- TMPL_VAR NAME="type_link_value" -->=<!-- TMPL_VAR 
NAME="facet_link_value" -->" title="<!-- TMPL_VAR NAME="facet_title_value" 
-->"><!-- TMPL_VAR NAME="facet_label_value" --></a> (<!-- TMPL_VAR 
NAME="facet_count" -->)</li>
        <!-- /TMPL_LOOP -->
 <!-- TMPL_IF NAME="expandable" -->
-       <li class="showmore"><a 
href="/cgi-bin/koha/opac-zoomsearch.pl?op=get_results&amp;ccl_query=<!-- 
TMPL_VAR NAME="searchdesc" -->&amp;expand=<!-- TMPL_VAR NAME="expand" -->#<!-- 
TMPL_VAR NAME="typeid" -->">Show More</a></li>
+       <li class="showmore"><a href="/search?q=<!-- TMPL_VAR NAME="searchdesc" 
-->&amp;expand=<!-- TMPL_VAR NAME="expand" -->#<!-- TMPL_VAR NAME="type_id" 
-->">Show More</a></li>
 <!-- /TMPL_IF -->
 </ul></li>
 <!-- /TMPL_LOOP -->




reply via email to

[Prev in Thread] Current Thread [Next in Thread]