Expose ability to use filter groups in TPac
authorThomas Berezansky <tsbere@mvlc.org>
Fri, 3 Aug 2012 15:34:05 +0000 (11:34 -0400)
committerDan Scott <dscott@laurentian.ca>
Thu, 16 Aug 2012 02:57:22 +0000 (22:57 -0400)
Via config options for basic and advanced search.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/templates/opac/parts/advanced/search.tt2
Open-ILS/src/templates/opac/parts/config.tt2
Open-ILS/src/templates/opac/parts/searchbar.tt2

index 4328086..5af1d2e 100644 (file)
@@ -87,6 +87,9 @@
         ELSIF adv_chunk.adv_attr;
             INCLUDE "opac/parts/coded_value_selector.tt2"
                 attr=adv_chunk.adv_attr multiple="multiple" size="4";
+        ELSIF adv_chunk.adv_filter;
+            INCLUDE "opac/parts/filter_group_selector.tt2"
+                filter_group=adv_chunk.adv_filter multiple="multiple" size="4";
         END; %]
             </td>
 [%
index f23ef4d..2985f1f 100644 (file)
@@ -83,6 +83,7 @@ facet.display = [
 # adv_label is the (translated) label for the limiter
 # adv_attr is an array of possible limiters, the first one that has any
 #   values will be used
+# adv_filter is the same as adv_attr, but for search filter groups
 # adv_break will end the current row. If specified with a label/attr it
 #   will do so *after* that limiter.
 # adv_special will drop in a special entry:
@@ -111,4 +112,19 @@ search.adv_config = [
 
 search.default_qtypes = ['keyword','title','author'];
 
+##############################################################################
+# Basic Search Box definition
+# This allows selection of what, exactly, basic search uses for a selection
+# box. Previously it was hardcoded to use an attr box of mattype or item_type.
+#
+# type can be "attr" or "filter"
+# group is the attr or filter entries you want to check for
+# none_label is the label for the default nothing selected entry.
+
+search.basic_config = {
+    type => 'attr',
+    group => ['mattype','item_type'],
+    none_label => l("All Formats"),
+};
+
 %]
index d20d36b..b75752f 100644 (file)
             class="adv_search_font">[% l('Advanced Search') %]</span></a>
     </div>
     <div class="searchbar">[%- l('Search ');
-        INCLUDE "opac/parts/coded_value_selector.tt2"
-            attr=["mattype", "item_type"] none_ok=1 none_label=l('All Formats');
+        IF search.basic_config.type == 'attr';
+            INCLUDE "opac/parts/coded_value_selector.tt2"
+                attr=search.basic_config.group none_ok=1 none_label=search.basic_config.none_label;
+        ELSIF search.basic_config.type == 'filter';
+            INCLUDE "opac/parts/filter_group_selector.tt2"
+                filter_group=search.basic_config.group none_ok=1 none_label=search.basic_config.none_label;
+        END;
             l(' for ');
         %]
         <span class='search_box_wrapper'>