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

Joshua Ferraro jmf at kados.org
Mon Aug 7 20:41:02 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Joshua Ferraro <kados>	06/08/07 18:41:02

Modified files:
	C4             : Search.pm 
	koha-tmpl/opac-tmpl/npl/en/includes: doc-head-close.inc 
	                                     navigation.inc 
	opac           : opac-zoomsearch.pl 

Log message:
	Removing use of tigra menus for faceted searches ... moving them
	to a nested tmpl_loop

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.16&r2=1.99.2.11.2.17
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/npl/en/includes/doc-head-close.inc?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.11.2.5&r2=1.1.2.11.2.6
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.9&r2=1.2.2.4.2.10
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-zoomsearch.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.18&r2=1.1.2.19

Patches:
Index: C4/Search.pm
===================================================================
RCS file: /sources/koha/koha/C4/Search.pm,v
retrieving revision 1.99.2.11.2.16
retrieving revision 1.99.2.11.2.17
diff -u -b -r1.99.2.11.2.16 -r1.99.2.11.2.17
--- C4/Search.pm	3 Aug 2006 05:25:41 -0000	1.99.2.11.2.16
+++ C4/Search.pm	7 Aug 2006 18:41:01 -0000	1.99.2.11.2.17
@@ -35,7 +35,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.16 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.99.2.11.2.17 $' =~ /\d+/g;
           shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -4153,12 +4153,9 @@
         $result->sort("yaz", "$then_sort_by")
     }
     #### INITIALIZE SOME VARS USED CREATE THE FACETED RESULTS
-    my $facets = "";
+	my @facets_loop; # stores the ref to array of hashes for template
 	my ($subject_facets, $series_facets, $author_facets);
-	my %subject_facets_counter; my %subject_facets_counter_subs;
-	my %subject_subdivision; my %subject_sub_subdivision;
-	my %series_facets_counter;
-	my %author_facets_counter;
+	my (%subject_facets_counter, %series_facets_counter, %author_facets_counter);
 
 	#### LOOP THROUGH THE RESULTS	
     $numresults = 0 | $result->size() if  ($result);
@@ -4185,7 +4182,7 @@
             ##### BUILD FACETS ####
 			my $facet_record = MARC::Record->new_from_usmarc($rec->raw());
 
-            # Define Series Facets
+            # Define Subject Facets
             my @subject_fields = $facet_record->field('650');
             my $subject_term;
             foreach my $subjectfield (@subject_fields) {
@@ -4227,121 +4224,50 @@
         }
     }
 	# BUILD FACETS
-    foreach my $value (sort { $subject_facets_counter{$b} <=> $subject_facets_counter{$a} } keys %subject_facets_counter) {
-		my $linkvalue = $value;
-		my $captionvalue = $value;
-		my $count = $subject_facets_counter{$value};
-		$linkvalue =~ s/\'/\\\'/g;
-		$captionvalue =~ s/\'/&apos;/g;
-	}
-
     # Build subject facets
-	my $number_of_subject_facets;
-	my $end_bracket;
+	my @subject_facets_array;
     foreach my $value (sort { $subject_facets_counter{$b} <=> $subject_facets_counter{$a} } keys %subject_facets_counter) {
-		$number_of_subject_facets++;
         my $linkvalue = $value;
         my $captionvalue = $value;
         my $count = $subject_facets_counter{$value};
         $linkvalue =~ s/\'/\\\'/g;
         $captionvalue =~ s/\'/&apos;/g;
-        if (!$subject_facets) { # the first one shouldn't have the comma
-            $subject_facets .="
-            [";
-        } 
-		else {
-            $subject_facets .="
-            ,[";
-        }
-        $subject_facets.="
-        \' $captionvalue ( $count )\','/cgi-bin/koha/opac-zoomsearch.pl?op=get_results&amp;ccl_query=subject=&quot;$linkvalue&quot;'";
-		if ($number_of_subject_facets==5) {
-			$subject_facets.="], ['See More...',null";
-			$end_bracket = 1;
-		}
-		else {
-        	$subject_facets.="]";
-		}
-    }
-	if ($end_bracket) { 
-		$subject_facets.="]"; 
+		push @subject_facets_array , (
+			{count => $count,label => $captionvalue,link =>"/cgi-bin/koha/opac-zoomsearch.pl?op=get_results&amp;ccl_query=su=&quot;$linkvalue&quot;"}
+		);
 	}
+	push @facets_loop, ( {type => 'Subjects',facets => \@subject_facets_array} );
  
 	# Build series facets
+	my @series_facets_array;
 	foreach my $value (sort { $series_facets_counter{$b} <=> $series_facets_counter{$a} } keys %series_facets_counter) {
 		my $linkvalue = $value;
 		my $captionvalue = $value;
 		my $count = $series_facets_counter{$value};
 		$linkvalue =~ s/\'/\\\'/g;
 		$captionvalue =~ s/\'/&apos;/g;
-		if (!$series_facets) { # the first one shouldn't have the comma
-			$series_facets .="
-			[";
-		} else {
-			$series_facets .="
-			,[";
-		}
-		$series_facets.="
-		\' $captionvalue ( $count )\','/cgi-bin/koha/opac-zoomsearch.pl?op=get_results&amp;ccl_query=series=&quot;$linkvalue&quot;'";
-		$series_facets.="]";
+
+		push @series_facets_array , (
+            {count => $count,label => $captionvalue,link =>"/cgi-bin/koha/opac-zoomsearch.pl?op=get_results&amp;ccl_query=series=&quot;$linkvalue&quot;"}
+		);
 	}
+    push @facets_loop, ( {type => 'Series',facets => \@series_facets_array} );
+
     # Build author facets
+	my @author_facets_array;
     foreach my $value (sort { $author_facets_counter{$b} <=> $author_facets_counter{$a} } keys %author_facets_counter) {
         my $linkvalue = $value;
 		my $captionvalue = $value;
 		my $count = $author_facets_counter{$value};
         $linkvalue =~ s/\'/\\\'/g;
 		$captionvalue =~ s/\'/&apos;/g;
-        if (!$author_facets) { # the first one shouldn't have the comma
-            $author_facets .="
-            [";
-        } else {
-            $author_facets .="
-            ,[";
-        }
-        $author_facets.="
-        \' $captionvalue ( $count )\','/cgi-bin/koha/opac-zoomsearch.pl?op=get_results&amp;ccl_query=au=&quot;$linkvalue&quot;'";
-        $author_facets.="]";
-    }
-
-	# POPULATE DEFAULT FACETS
-	my $default_facets = C4::Context->preference("default_facets");
-	# if we've got facets of our own, ignore the default ones
-	if (($subject_facets) or ($series_facets) or ($author_facets)) {
-		$facets.="var DEFAULT_TREE = '';\n";
-	}
-	# otherwise, load the defaults up
-	else {
-		$facets.="$default_facets\n";
-	}
-	# POPULATE SUBJECT FACETS
-    if ($subject_facets) {
-        $facets.="var SUBJECT_TREE = [
-        ['Subjects', 0,
-        $subject_facets
-        ]];\n";
-    }
-	else { $facets.="var SUBJECT_TREE = '';\n"; }
-
-	# POPULATE SERIES FACETS
-    if ($series_facets) {
-        $facets.="var SERIES_TREE = [
-        ['Series', 0,
-        $series_facets
-        ]];\n";
-    }
-	else { $facets.="var SERIES_TREE = '';\n"; }
-
-    # POPULATE AUTHOR FACETS
-    if ($author_facets) {
-        $facets.="var AUTHOR_TREE = [
-        ['Authors', 0,
-        $author_facets
-        ]];\n";
+		push @author_facets_array , (
+            {count => $count,label => $captionvalue,link =>"/cgi-bin/koha/opac-zoomsearch.pl?op=get_results&amp;ccl_query=au=&quot;$linkvalue&quot;"}
+        );
     }
-	else { $facets.="var AUTHOR_TREE = '';\n"; } 
+    push @facets_loop, ( {type => 'Authors',facets => \@author_facets_array} );
     
-	return(undef,$numresults,$facets, at results);
+	return(undef,$numresults,\@facets_loop, at results);
 }
 
 

Index: koha-tmpl/opac-tmpl/npl/en/includes/doc-head-close.inc
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/opac-tmpl/npl/en/includes/doc-head-close.inc,v
retrieving revision 1.1.2.11.2.5
retrieving revision 1.1.2.11.2.6
diff -u -b -r1.1.2.11.2.5 -r1.1.2.11.2.6
--- koha-tmpl/opac-tmpl/npl/en/includes/doc-head-close.inc	25 Jul 2006 18:13:46 -0000	1.1.2.11.2.5
+++ koha-tmpl/opac-tmpl/npl/en/includes/doc-head-close.inc	7 Aug 2006 18:41:02 -0000	1.1.2.11.2.6
@@ -28,9 +28,6 @@
 	@import url(<!-- TMPL_VAR NAME="themelang" -->/includes/livesearch.css);
 </style>
 <!-- /TMPL_IF -->
-<!-- TMPL_IF NAME="opacfacets" -->
-<!-- TMPL_INCLUDE NAME="opac-facets.inc" -->
-<!-- /TMPL_IF -->
 <script language="javascript" type="text/javascript">
 function Help() {
 	newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');

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.9
retrieving revision 1.2.2.4.2.10
diff -u -b -r1.2.2.4.2.9 -r1.2.2.4.2.10
--- koha-tmpl/opac-tmpl/npl/en/includes/navigation.inc	28 Jul 2006 01:45:34 -0000	1.2.2.4.2.9
+++ koha-tmpl/opac-tmpl/npl/en/includes/navigation.inc	7 Aug 2006 18:41:02 -0000	1.2.2.4.2.10
@@ -19,19 +19,15 @@
 <div style="overflow: auto;" id="nav">
 <!-- TMPL_VAR NAME="OpacNav" -->
 <!-- TMPL_IF NAME="opacfacets" -->
-    <!-- Sample -->
-    <table style="width:18%; padding : 0; margin : 0;">
-    <tr><td class="intd">
-        <script type="text/javascript" language="javascript">
-            <!--
-			new tree (DEFAULT_TREE, default_tpl);
-			new tree (LIMITS_TREE, limits_tpl);
-            new tree (SUBJECT_TREE, subject_tpl);
-            new tree (SERIES_TREE, series_tpl);
-            new tree (AUTHOR_TREE, author_tpl);
-			//-->
-		</script>
-	</td></tr>
-    </table>
+<ul>
+<!-- TMPL_LOOP NAME="facets_loop" -->
+<li><!-- TMPL_VAR NAME="type" --></li>
+<li><ul>
+	<!-- TMPL_LOOP NAME="facets" -->
+		<li><a href="<!-- TMPL_VAR NAME=link -->"><!-- TMPL_VAR NAME="label" --></a>(<!-- TMPL_VAR NAME="count" -->)</li>
+	<!-- /TMPL_LOOP -->
+</ul></li>
+<!-- /TMPL_LOOP -->
+</ul>
 <!-- /TMPL_IF -->
 </div>

Index: opac/opac-zoomsearch.pl
===================================================================
RCS file: /sources/koha/koha/opac/Attic/opac-zoomsearch.pl,v
retrieving revision 1.1.2.18
retrieving revision 1.1.2.19
diff -u -b -r1.1.2.18 -r1.1.2.19
--- opac/opac-zoomsearch.pl	25 Jul 2006 18:13:46 -0000	1.1.2.18
+++ opac/opac-zoomsearch.pl	7 Aug 2006 18:41:02 -0000	1.1.2.19
@@ -179,7 +179,7 @@
 	$template->param(results_per_page =>  $number_of_results );
 	$template->param(SEARCH_RESULTS => \@newresults);
 	$template->param(PREVIOUS_CCL_QUERIES => \@previous_ccl_queries);
-	$template->param(facets => $facets);
+	$template->param(facets_loop => $facets);
 
 	#this is to show the page numbers to navigate among the results, whether it has to show the number highlighted or not
 	my $numbers;





More information about the Koha-cvs mailing list