LP#1203792: Multiple 006/007/008 fields for MARC Editor user/simonmai/multiple_006_007_008_fields
authorSimon Hieu Mai <hieu.mai@mnsu.edu>
Mon, 22 Jul 2013 15:39:50 +0000 (11:39 -0400)
committerSimon Hieu Mai <hieu.mai@mnsu.edu>
Mon, 22 Jul 2013 15:39:50 +0000 (11:39 -0400)
This patch will make the MARC Edtior to support adding multiple 006/007/008 fields per bib record.

It changes the current "Add/Replace 006/007/008" of right-clicking drop down menu into "Add 006/007/008"
that lets staff add multiple 006/007/008 fields.

To delete any these fields, just right click and select "Remove Row" as the way we've used to remove
other data fields.

Signed-off-by: Simon Hieu Mai <hieu.mai@mnsu.edu>
Open-ILS/xul/staff_client/server/cat/marcedit.js
Open-ILS/xul/staff_client/server/locale/en-US/cat.properties

index 61b2667..3dbb9f1 100644 (file)
@@ -73,7 +73,9 @@ function mangle_005() {
 
 function createControlField (tag,data) {
     // first, remove the old field, if any;
-    for (var i in xml_record.controlfield.(@tag == tag)) delete xml_record.controlfield.(@tag == tag)[i];
+    if (tag == '005'){
+       for (var i in xml_record.controlfield.(@tag == tag)) delete xml_record.controlfield.(@tag == tag)[i];
+    }
 
     var cf = <controlfield tag="" xmlns="http://www.loc.gov/MARC21/slim">{ data }</controlfield>;
     cf.@tag = tag;
@@ -86,7 +88,7 @@ function createControlField (tag,data) {
         var t = Number(cfields[i].@tag.toString().substring(2));
         if (t > base) {
             xml_record.insertChildBefore( cfields[i], cf );
-            done = 1
+            done = 1;
             break;
         }
     }
@@ -903,9 +905,8 @@ function marcLeader (leader) {
 
 function marcControlfield (field) {
     tagname = field.@tag.toString().substr(2);
-    var row;
-    if (tagname == '1' || tagname == '3' || tagname == '6' || tagname == '7' || tagname == '8') {
-        row = createRow(
+    if (tagname == '1' || tagname == '3') {
+      var row = createRow(
             { class : 'marcControlfieldRow',
               tag : '_' + tagname },
             createLabel(
@@ -932,9 +933,51 @@ function marcControlfield (field) {
                   context : 'clipboard',
                   size : 50,
                   maxlength : 50 } )
-            );
-    } else {
-        row = createRow(
+      );
+    }else if (tagname == '6' || tagname == '7' || tagname == '8') {
+      var row = createRow(
+        { class : 'marcDatafieldRow' },
+        createMARCTextbox(
+            field.@tag,
+            { value : field.@tag,
+              class : 'plain marcTag',
+              name : 'marcTag',
+              context : 'tags_popup',
+              oninput : 'if (this.value.length == 3) { this.nextSibling.focus(); }',
+              size : 3,
+              maxlength : 3,
+              onmouseover : 'current_focus = this; getTooltip(this, "tag");' } ),
+        createMARCTextbox(
+            field.@ind1,
+            { value : field.@ind1,
+              class : 'plain marcInd1',
+              name : 'marcInd1',
+              oninput : 'if (this.value.length == 1) { this.nextSibling.focus(); }',
+              size : 1,
+              maxlength : 1,
+              onmouseover : 'current_focus = this; getContextMenu(this, "ind1"); getTooltip(this, "ind1");',
+              oncontextmenu : 'getContextMenu(this, "ind1");' } ),
+        createMARCTextbox(
+            field.@ind2,
+            { value : field.@ind2,
+              class : 'plain marcInd2',
+              name : 'marcInd2',
+              oninput : 'if (this.value.length == 1) { this.nextSibling.firstChild.firstChild.focus(); }',
+              size : 1,
+              maxlength : 1,
+              onmouseover : 'current_focus = this; getContextMenu(this, "ind2"); getTooltip(this, "ind2");',
+              oncontextmenu : 'getContextMenu(this, "ind2");' } ),
+        createMARCTextbox(
+                field,
+                { value : field.text(),
+                  class : 'plain marcEditableControlfield',
+                  name : 'CONTROL' + tagname,
+                  context : 'clipboard',
+                  size : 50,
+                  maxlength : 50 } )
+      );
+    }else{
+        var row = createRow(
             { class : 'marcControlfieldRow',
               tag : '_' + tagname },
             createLabel(
@@ -957,7 +1000,6 @@ function marcControlfield (field) {
                   class : 'marcControlfield' } )
         );
     }
-
     return row;
 }
 
index f42ec10..8b341df 100644 (file)
@@ -258,9 +258,9 @@ staff.cat.marcedit.marcTag.LDR.label=MARC Leader
 staff.cat.marcedit.add_row.label=Add Row
 staff.cat.marcedit.insert_row.label=Insert Row
 staff.cat.marcedit.remove_row.label=Remove Row
-staff.cat.marcedit.replace_006.label=Add/Replace 006
-staff.cat.marcedit.replace_007.label=Add/Replace 007
-staff.cat.marcedit.replace_008.label=Add/Replace 008
+staff.cat.marcedit.replace_006.label=Add 006
+staff.cat.marcedit.replace_007.label=Add 007
+staff.cat.marcedit.replace_008.label=Add 008
 staff.cat.marcedit.not_authority_field.label=Not a controlled subfield
 staff.cat.marcedit.apply_full.label=Apply Full Authority (1XX)
 staff.cat.marcedit.apply_selected.label=Apply Selected