LP#1053397 Prevent display non-opac-visible icons / hold formats
authorBill Erickson <berick@esilibrary.com>
Fri, 21 Feb 2014 18:48:07 +0000 (13:48 -0500)
committerDan Wells <dbw2@calvin.edu>
Fri, 21 Feb 2014 20:38:56 +0000 (15:38 -0500)
Avoid showing coded value maps for icons, hold formats, and hold
languages where the coded value's opac_visible value is FALSE.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/templates/opac/myopac/holds.tt2
Open-ILS/src/templates/opac/parts/metarecord_hold_filters.tt2
Open-ILS/src/templates/opac/parts/misc_util.tt2

index b08d230..0f5555a 100644 (file)
                               # only show selected formats for metarecords
                               formats = [];
                               FOR ccvm IN hold.metarecord_selected_filters.icons;
+                                NEXT IF ccvm.opac_visible == 'f';
                                 format = {};
-                                format.icon = PROCESS get_ccvm_icon id=ccvm.id search_label=1;
-                                format.label = PROCESS get_ccvm_label id=ccvm.id search_label=1;
+                                format.label = ccvm.search_label || ccvm.value;
+                                format.icon = PROCESS get_ccvm_icon ccvm=ccvm;
                                 formats.push(format);
                               END;
                             END;
index 452feed..5478400 100644 (file)
@@ -47,8 +47,9 @@ limiting the set of desired records for a given metarecord.
     </div>
     <select multiple='multiple' 
       name="metarecord_formats_[% target_id %]">
-      [% FOR ccvm IN 
-        hold_data.metarecord_filters.formats.sort('search_label') %]
+      [% FOR ccvm IN
+          hold_data.metarecord_filters.formats.sort('search_label');
+          NEXT IF ccvm.opac_visible == 'f' %]
         <option value="[% ccvm.code %]"[%- code = ccvm.code; 
             IF selected_formats.$code %] selected='selected'[% END -%]>
           [% ccvm.search_label | html %]
@@ -65,8 +66,9 @@ limiting the set of desired records for a given metarecord.
     </div>
     <select multiple='multiple' 
       name="metarecord_langs_[% target_id %]">
-      [% FOR lang_ccvm IN hold_data.metarecord_filters.langs.sort('value') %]
-        [%  selected = 0; 
+      [% FOR lang_ccvm IN hold_data.metarecord_filters.langs.sort('value');
+            NEXT IF lang_ccvm.opac_visible == 'f';
+            selected = 0; 
             code = lang_ccvm.code;
             IF selected_langs.size;
                 # user has already selected their preferred language(s)
index c003c15..63b82b4 100644 (file)
         END;
     END;
 
-    BLOCK get_ccvm_label;
-        ccvm = ctx.get_ccvm(id); # caches internally
-        IF search_label and ccvm.search_label;
-            ccvm.search_label;
-        ELSE;
-            ccvm.$id.value;
-        END;
-    END;
-
     BLOCK get_ccvm_icon;
-        ccvm = ctx.get_ccvm(id); # caches internally
-        label = PROCESS get_ccvm_label id=id search_label=search_label;
         ctx.media_prefix _ '/images/format_icons/' _ ccvm.ctype _ '/' _ ccvm.code _ '.png';
     END;
 
-
     # Extract MARC fields from XML
     #   get_marc_attrs( { marc_xml => doc } )
     BLOCK get_marc_attrs;
         args.all_formats = [];
         FOR node IN xml.findnodes(formats_xpath);
             IF node AND node.textContent;
-                type = node.textContent;
+                ccvm = ctx.get_ccvm(node.getAttribute('cvmid'));
+                NEXT IF ccvm.opac_visible == 'f';
+
                 format = {};
-                format.icon = PROCESS get_ccvm_icon 
-                    id=node.getAttribute('cvmid') search_label=1;
-                format.label = PROCESS get_ccvm_label 
-                    id=node.getAttribute('cvmid') search_label=1;
+                type = node.textContent;
+                format.label = ccvm.search_label || ccvm.value;
+                format.icon = PROCESS get_ccvm_icon ccvm=ccvm;
                 format.itemtype = schema_typemap.$type || 'CreativeWork';
 
                 args.all_formats.push(format); # metarecords want all formats