work toward holding code wizard support for subfield o
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 17 Sep 2013 21:12:57 +0000 (17:12 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 17 Sep 2013 21:13:20 +0000 (17:13 -0400)
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/web/css/skin/default/serial.css
Open-ILS/web/js/dojo/openils/serial/nls/serial.js
Open-ILS/web/js/dojo/openils/widget/HoldingCode.js

index b1b486e..14279bf 100644 (file)
@@ -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%; }
index 4c3d020..c1f57ef 100644 (file)
@@ -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"
 }
index 5d5865f..60a9b83 100644 (file)
@@ -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);