From 12b30ac72f4cac845ec864271d2898e3b5acc5e7 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Tue, 17 Sep 2013 17:12:57 -0400 Subject: [PATCH] work toward holding code wizard support for subfield o Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/web/css/skin/default/serial.css | 1 + Open-ILS/web/js/dojo/openils/serial/nls/serial.js | 3 ++- Open-ILS/web/js/dojo/openils/widget/HoldingCode.js | 27 +++++++++++++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/css/skin/default/serial.css b/Open-ILS/web/css/skin/default/serial.css index b1b486ef2f..14279bf9ac 100644 --- a/Open-ILS/web/css/skin/default/serial.css +++ b/Open-ILS/web/css/skin/default/serial.css @@ -26,3 +26,4 @@ .serial-holding-code td { border: 0 !important; padding: 3px; margin: 0 !important; } .serial-holding-code td[colspan="2"] { text-align:center; } input[readonly] { color: #999; } +.serial-holding-code-wizard-subfield-o { margin-left: 1em; font-size: 85%; } diff --git a/Open-ILS/web/js/dojo/openils/serial/nls/serial.js b/Open-ILS/web/js/dojo/openils/serial/nls/serial.js index 4c3d020ccb..c1f57ef493 100644 --- a/Open-ILS/web/js/dojo/openils/serial/nls/serial.js +++ b/Open-ILS/web/js/dojo/openils/serial/nls/serial.js @@ -12,5 +12,6 @@ "SELECTED_SCAP": "Have you selected a valid caption and pattern?", "NO_CAPTIONS_IN_SELECTED_SCAP": "No caption subfields in selected caption and pattern", "NO_BLANKS_BOSS": "A valid holding code cannot be produced with any blank fields.", - "WIZARD": "Wizard" + "WIZARD": "Wizard", + "SUBFIELD_O": "Title of Unit" } diff --git a/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js b/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js index 5d5865f9f7..60a9b839ad 100644 --- a/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js +++ b/Open-ILS/web/js/dojo/openils/widget/HoldingCode.js @@ -3,6 +3,7 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.form.DropDownButton"); dojo.require("dijit.form.TextBox"); + dojo.require("dojo.string"); /* XXX These variables and functions preceding the call to dojo.declar() * all pollute the window namespace. They're not written as methods for @@ -69,7 +70,12 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { } function _generate_dijit_for_field(field, tr) { - dojo.create("td", {"innerHTML": field.caption}, tr); + dojo.create( + "td", { + "innerHTML": field.caption, + "className": "serial-holding-code-wizard-subfield-" + field.subfield + }, tr + ); /* Any more special cases than this and we should switch to a dispatch * table or something. */ @@ -94,6 +100,22 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { return input; } + function _interleave_subfields_o(fields) { + var result = []; + for (var i = 0; i < fields.length; i++) { + result.push(fields[i]); + if (fields[i].subfield <= "h") { + var caption = openils.widget.HoldingCode.localeStrings.SUBFIELD_O; + result.push({ + "subfield": "o", + "caption": caption, "pattern_value": caption + }); + } + } + + return result; + } + function _prepare_ttip_dialog_fields(div, fields, wizard) { /* XXX TODO Don't assume these defaults for the indicators and $8, and * provide reasonable control over them. */ @@ -102,6 +124,9 @@ if (!dojo._hasResource["openils.widget.HoldingCode"]) { wizard.wizard_button.attr("disabled", true); var table = dojo.create("table", {"className": "serial-holding-code"}); + + fields = _interleave_subfields_o(fields); + fields.forEach( function(field) { var tr = dojo.create("tr", null, table); -- 2.11.0