The advanced cataloging editor lets users hand-edit MARC records as
text but offers no equivalent of the basic editor's value_builder
popups for the fixed-length fields (Leader, 006, 007 and 008).
Catalogers have to type those byte strings by hand, which is error
prone.
This patch wires the 'open_helper_plugin' shortcut (added in the
preceding atomic update) to a new handler in the advanced editor
which:
- inspects the line under the cursor;
- if it is a Leader, 006, 007 or 008 control field, opens the
corresponding marc21_*.pl plugin from cataloguing/value_builder/
in a popup window, pre-populated with the current value;
- splices the plugin's returned value back into the CodeMirror buffer
when the popup closes.
The plugin templates are reused unchanged: a hidden
<input id="adv_editor_fixedfield_buffer"> on the editor page satisfies
the existing report() callback contract, and the editor polls
window.closed to detect submission. The 008 plugin is given the
current Leader value via &leader= so its material-type byte map
matches the record being edited.
The shortcut description is added to keyboard_shortcuts.inc so it
appears with a meaningful label in the in-editor "show shortcuts"
popover and in Administration > Keyboard shortcuts.
Test plan:
1. Apply this patch on top of the preceding atomic update.
2. Visit Administration > Keyboard shortcuts and confirm
'open_helper_plugin' is listed with description "Open fixed-length
field helper (Leader, 006, 007, 008)" and that the key combination
can be edited.
3. Open the advanced cataloging editor on any record:
a. Place the cursor on the 000 (Leader) line and press Shift-Ctrl-H.
The marc21_leader popup should open with the current Leader
value. Make a change, click OK, and confirm the Leader line
updates in the editor and is marked modified in the gutter.
b. Repeat for 006, 007 and 008. For 008, change the Leader's
material-type byte first and confirm the 008 popup form adapts.
c. Place the cursor on a 245 (or any non-fixed-length field) line
and press Shift-Ctrl-H. Nothing should happen.
d. Open a popup, then close it without saving. The editor line
should remain unchanged.
4. Save the record and confirm the new fixed-field values round-trip
correctly when the record is reloaded.
5. Confirm the basic editor's value_builder popups still work
unchanged on Leader / 006 / 007 / 008.
Sponsored-by: Main Library Alliance <https://www.mainlib.org/>
Signed-off-by: Jeanne Mauriello <jeanne.mauriello@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>