[open-ils-commits] r12859 - trunk/Open-ILS/xul/staff_client/server/cat (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Apr 13 23:10:06 EDT 2009
Author: dbs
Date: 2009-04-13 23:10:03 -0400 (Mon, 13 Apr 2009)
New Revision: 12859
Modified:
trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
Log:
First stab at copying fields in the MARC editor:
* CTRL-UP pastes a copy of the current field & subfields before the current field
* CTRL-DOWN pastes a copy of the current field & subfields after the current field
Modified: trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js 2009-04-14 02:48:13 UTC (rev 12858)
+++ trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js 2009-04-14 03:10:03 UTC (rev 12859)
@@ -441,6 +441,42 @@
row.nextSibling.firstChild.focus();
}
+ } else if (event.keyCode == 38 || event.keyCode == 40) { // up-arrow or down-arrow
+ if (event.ctrlKey) { // CTRL key: copy the field
+ var index;
+ if (element.localName() == 'subfield') index = element.parent();
+ if (element.localName() == 'code') index = element.parent().parent();
+ if (element.localName() == 'tag') index = element.parent();
+ if (element.localName() == 'ind1') index = element.parent();
+ if (element.localName() == 'ind2') index = element.parent();
+
+ var copyField = index.copy();
+
+ if (event.keyCode == 38) { // ctrl+up-arrow
+ index.parent().insertChildBefore( index, copyField );
+ } else {
+ index.parent().insertChildAfter( index, copyField );
+ }
+
+ var new_df = marcDatafield(copyField);
+
+ if (row.parentNode.lastChild === row) {
+ row.parentNode.appendChild( new_df );
+ } else {
+ if (event.keyCode == 38) { // ctrl+up-arrow
+ row.parentNode.insertBefore( new_df, row );
+ } else { // ctrl+down-arrow
+ row.parentNode.insertBefore( new_df, row.nextSibling );
+ }
+ }
+
+ new_df.firstChild.focus();
+
+ event.preventDefault();
+
+ return false;
+ }
+
} else if (event.keyCode == 46 && event.ctrlKey) { // ctrl+del
var index;
More information about the open-ils-commits
mailing list