From d494eab62e2335dc601a3fea8e9c7e46445953c4 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 3 Sep 2010 19:58:01 +0000 Subject: [PATCH] backporting r17476, r17477 and r17486 from trunk -- MARC Dojo module improvements git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@17487 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/MARC/Field.js | 2 +- Open-ILS/web/js/dojo/MARC/Record.js | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/js/dojo/MARC/Field.js b/Open-ILS/web/js/dojo/MARC/Field.js index 9694c3840d..7242a8945b 100644 --- a/Open-ILS/web/js/dojo/MARC/Field.js +++ b/Open-ILS/web/js/dojo/MARC/Field.js @@ -47,7 +47,7 @@ if(!dojo._hasResource["MARC.Field"]) { }, addSubfields : function () { - for (var i in arguments) { + for (var i = 0; i < arguments.length; i++) { var code = arguments[i]; var value = arguments[++i]; this.subfields.push( [ code, value ] ); diff --git a/Open-ILS/web/js/dojo/MARC/Record.js b/Open-ILS/web/js/dojo/MARC/Record.js index 635015f281..d2f6b1d2be 100644 --- a/Open-ILS/web/js/dojo/MARC/Record.js +++ b/Open-ILS/web/js/dojo/MARC/Record.js @@ -68,11 +68,11 @@ if(!dojo._hasResource["MARC.Record"]) { insertOrderedFields : function () { var me = this; - for ( var i in arguments ) { // arguments is special, and for..in is correct + for (var i = 0; i < arguments.length; i++) { var f = arguments[i]; var done = false; for (var j = 0; j < this.fields.length; j++) { - if (f.tag > this.fields[j].tag) { + if (f.tag < this.fields[j].tag) { this.insertFieldsBefore(this.fields[j], f); done = true; break; @@ -83,12 +83,13 @@ if(!dojo._hasResource["MARC.Record"]) { }, insertFieldsBefore : function (target) { - arguments.splice(0,1); + var args = Array.prototype.slice.call(arguments); + args.splice(0,1); var me = this; for (var j = 0; j < this.fields.length; j++) { if (target === this.fields[j]) { j--; - dojo.forEach( arguments, function (f) { + dojo.forEach( args, function (f) { me.fields.splice(j++,0,f); }); break; @@ -97,11 +98,12 @@ if(!dojo._hasResource["MARC.Record"]) { }, insertFieldsAfter : function (target) { - arguments.splice(0,1); + var args = Array.prototype.slice.call(arguments); + args.splice(0,1); var me = this; for (var j = 0; j < this.fields.length; j++) { if (target === this.fields[j]) { - dojo.forEach( arguments, function (f) { + dojo.forEach( args, function (f) { me.fields.splice(j++,0,f); }); break; -- 2.11.0