Override item_type coded values in selector
authorJeff Godin <jgodin@tadl.org>
Tue, 31 Jul 2012 13:48:15 +0000 (09:48 -0400)
committerJeff Godin <jgodin@tadl.org>
Tue, 31 Jul 2012 13:48:15 +0000 (09:48 -0400)
Until such time as we have some of the newer features like opac
visible names and opac visibility toggles for coded values, locally
override item_type values in the skin template.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
templates_tadlskin/opac/parts/coded_value_selector.tt2

index 0016b7a..7e35a81 100644 (file)
@@ -1,4 +1,14 @@
 
+[%
+item_type_override = {
+    'a' => 'Books',
+    'i' => 'Audiobooks',
+    'g' => 'Video Recordings',
+    'j' => 'Music',
+    'm' => 'Electronic Resources',
+};
+%]
+
 [%- 
     # If caller passes a list of possible attribute types, 
     # search all until we find some values
         all_values = ctx.search_ccvm('ctype', attr_class);
         IF all_values.size > 0; LAST; END;
     END;
+
+    new_all_values = [];
+    IF attr_class == 'item_type';
+        FOR db_value IN all_values;
+            IF item_type_override.${db_value.code};
+                new_all_values.push( {'code'=>db_value.code, 'value'=> item_type_override.${db_value.code}} );
+            END;
+         END;
+        all_values = new_all_values;
+    END;
+
     name = name || "fi:" _ attr_class;
     id = id || attr_class _ "_selector";
     values = values || CGI.param(name);