Edición de subcampos codificados en Catalis

A raíz de una consulta en el grupo Catalis, acá va una receta para lograr que un subcampo se pueda editar de manera análoga al subcampo $4 de los campos 700 (relator code).

XML

frequency.xml

<?xml version="1.0" encoding="ISO-8859-1"?> <relatorCodes> <relator code="act" name="Actor" /> <relator code="adp" name="Adapter" /> <relator code="aft" name="Author of afterword, colophon, etc." /> <relator code="ann" name="Annotator" /> <relator code="ant" name="Bibliographic antecedent" /> <relator code="app" name="Applicant" /> <relator code="aqt" name="Author in quotations or text abstracts" /> <relator code="arc" name="Architect" /> <relator code="arr" name="Arranger" /> ... <relator code="wit" name="Witness" /> </relatorCodes>

HTML

editCodes.htm

case "relator" : // TO-DO: pensar de qué manera se puede acotar la larga lista, en función del tipo // de documento (video, musica, libro, etc.) xmlCodes = callingWindowObject.xmlRelatorCodes; Codes = xmlCodes.selectNodes("/" + "/relator"); title = "Relator codes"; break; case "frequency" : xmlCodes = callingWindowObject.xmlFrequencyCodes; Codes = xmlCodes.selectNodes("/" + "/frequency"); title = "Frequency codes"; break;

JavaScript

create-field-subfield.js

// Subcampos cuyos valores se toman de tablas if ( "4" == code ) { // Relator code newSubfieldBox.readOnly = true; // ATENCION: esta propiedad produce un bug al subir/bajar un subcampo $4 vacío newSubfieldBox.onclick = function() { editCodedData("relator"); } newSubfieldBox.style.fontFamily = "lucida console"; newSubfieldBox.style.fontSize = "14px"; newSubfieldBox.style.lineHeight = "17px"; } else if ( tag_code.search(/86[34]w/) != -1 ) { // Frequency code. Expresión alternativa: /863w|864w/ newSubfieldBox.readOnly = true; newSubfieldBox.onclick = function() { editCodedData("frequency"); } newSubfieldBox.style.fontFamily = "lucida console"; newSubfieldBox.style.fontSize = "14px"; newSubfieldBox.style.lineHeight = "17px"; }

aux-windows.js

function editCodedData(dataElement) { if ( dataElement.search(/relator|frequency|f041|f044/) != -1 ) { var srcObject = event.srcElement; var activeCode = srcObject.value; // TO-DO: evt for mozilla var codeType = "single"; var dialogLeft = event.clientX - 70; var dialogTop = event.clientY - 130; var URL = URL_EDIT_CODES; } else if ( ... if ( dataElement.search(/relator|frequency|f041|f044/) != -1 ) { srcObject.value = newCode.value; //displayPermanentTitle(srcObject,newCode.description.substr(6),40,0); } else { ... }

catalis.js

URL_RELATOR_CODES = HTDOCS + "xml/relator.xml"; URL_FREQUENCY_CODES = HTDOCS + "xml/frequency.xml"; xmlRelatorCodes = importXML(URL_RELATOR_CODES); xmlFrequencyCodes = importXML(URL_FREQUENCY_CODES);