From 96d0855b26b1ff40af895755dbb04a6762a473fd Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Thu, 5 Apr 2012 15:39:40 -0400 Subject: [PATCH] Add "Simple" flag for selectors This causes JSPac to ignore them and TPac to sort them above a divider. Also fixes an issue where excessive escaping was being done on values. This would break some values in the value map selectors. Signed-off-by: Thomas Berezansky Signed-off-by: Ben Shum --- Open-ILS/examples/fm_IDL.xml | 1 + Open-ILS/src/sql/Pg/002.schema.config.sql | 3 ++- Open-ILS/src/sql/Pg/upgrade/XXXX.tpac_value_maps.sql | 3 ++- .../src/templates/opac/parts/coded_value_selector.tt2 | 17 ++++++++++++++--- Open-ILS/web/opac/skin/default/js/adv_global.js | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index c66eeaa70e..375f93fa5d 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -790,6 +790,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index af24ba4ec9..e32fda37c7 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -743,7 +743,8 @@ CREATE TABLE config.coded_value_map ( value TEXT NOT NULL, description TEXT, opac_visible BOOL NOT NULL DEFAULT TRUE, -- For TPac selectors - search_label TEXT + search_label TEXT, + is_simple BOOL NOT NULL DEFAULT FALSE ); CREATE VIEW config.language_map AS SELECT code, value FROM config.coded_value_map WHERE ctype = 'item_lang'; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.tpac_value_maps.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.tpac_value_maps.sql index 4e409ece67..6172f5ebe7 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.tpac_value_maps.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.tpac_value_maps.sql @@ -1,3 +1,4 @@ ALTER TABLE config.coded_value_map ADD COLUMN opac_visible BOOL NOT NULL DEFAULT TRUE, - ADD COLUMN search_label TEXT; + ADD COLUMN search_label TEXT, + ADD COLUMN is_simple BOOL NOT NULL DEFAULT FALSE; diff --git a/Open-ILS/src/templates/opac/parts/coded_value_selector.tt2 b/Open-ILS/src/templates/opac/parts/coded_value_selector.tt2 index acb464e38e..18bb4a4166 100644 --- a/Open-ILS/src/templates/opac/parts/coded_value_selector.tt2 +++ b/Open-ILS/src/templates/opac/parts/coded_value_selector.tt2 @@ -23,12 +23,23 @@ [% END; # turn the list of objects into a list of hashes to # leverage TT's array.sort('') behavior +simple_sorter = []; sorter = []; -FOR o IN all_values; - sorter.push({code => o.code, value => (o.search_label ? o.search_label : o.value)}); +FOR o IN all_values; + IF o.is_simple == 't'; + simple_sorter.push({code => o.code, value => (o.search_label ? o.search_label : o.value)}); + ELSE; + sorter.push({code => o.code, value => (o.search_label ? o.search_label : o.value)}); + END; END; +FOR o IN simple_sorter.sort('value') %] + +[% END; +IF simple_sorter.size && sorter.size %] + +[% END; FOR o IN sorter.sort('value') %] - + [% END -%] diff --git a/Open-ILS/web/opac/skin/default/js/adv_global.js b/Open-ILS/web/opac/skin/default/js/adv_global.js index de2987604b..daf3e677ff 100644 --- a/Open-ILS/web/opac/skin/default/js/adv_global.js +++ b/Open-ILS/web/opac/skin/default/js/adv_global.js @@ -16,7 +16,7 @@ function advgInit() { var ctypes = ["bib_level", "item_form", "item_type", "audience", "lit_form"]; - var req = new Request('open-ils.fielder:open-ils.fielder.ccvm.atomic', {"cache":1,"query":{"ctype":ctypes, "opac_visible":"t"}}); + var req = new Request('open-ils.fielder:open-ils.fielder.ccvm.atomic', {"cache":1,"query":{"ctype":ctypes, "opac_visible":"t", "is_simple":"f"}}); req.callback(advDrawBibExtras); req.request.ctypes = ctypes; req.send(); -- 2.11.0