From: phasefx Date: Wed, 15 Sep 2010 20:09:32 +0000 (+0000) Subject: refactoring for readability X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b964c5fbb786abd3b0ae6d69974eef55aa4fc214;p=evergreen%2Fmasslnc.git refactoring for readability git-svn-id: svn://svn.open-ils.org/ILS/trunk@17707 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js index 2575025adc..ef4a2698d0 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js @@ -29,16 +29,25 @@ function my_init() { // g.existing_copies = [ copy1, copy2, ... ] g.existing_copies = xul_param('existing_copies') || []; + function set_attr(id,attr,msgcat_key) { + var x = $(id); + if (x) { + x.setAttribute( + attr, + $('catStrings').getString(msgcat_key) + ); + } + } if (g.existing_copies.length > 0) { - document.getElementById('EditThenCreate').setAttribute('label',$('catStrings').getString('staff.cat.volume_copy_creator.edit_then_rebarcode.btn.label')); - document.getElementById('EditThenCreate').setAttribute('accesskey',$('catStrings').getString('staff.cat.volume_copy_creator.edit_then_rebarcode.btn.accesskey')); - document.getElementById('CreateWithDefaults').setAttribute('label',$('catStrings').getString('staff.cat.volume_copy_creator.rebarcode.btn.label')); - document.getElementById('CreateWithDefaults').setAttribute('accesskey',$('catStrings').getString('staff.cat.volume_copy_creator.rebarcode.btn.accesskey')); + set_attr('EditThenCreate','label','staff.cat.volume_copy_creator.edit_then_rebarcode.btn.label'); + set_attr('EditThenCreate','accesskey','staff.cat.volume_copy_creator.edit_then_rebarcode.btn.accesskey'); + set_attr('CreateWithDefaults','label','staff.cat.volume_copy_creator.rebarcode.btn.label'); + set_attr('CreateWithDefaults','accesskey','staff.cat.volume_copy_creator.rebarcode.btn.accesskey'); } else { - document.getElementById('EditThenCreate').setAttribute('label',$('catStrings').getString('staff.cat.volume_copy_creator.edit_then_create.btn.label')); - document.getElementById('EditThenCreate').setAttribute('accesskey',$('catStrings').getString('staff.cat.volume_copy_creator.edit_then_create.btn.accesskey')); - document.getElementById('CreateWithDefaults').setAttribute('label',$('catStrings').getString('staff.cat.volume_copy_creator.create_with_defaults.btn.label')); - document.getElementById('CreateWithDefaults').setAttribute('accesskey',$('catStrings').getString('staff.cat.volume_copy_creator.create_with_defaults.btn.accesskey')); + set_attr('EditThenCreate','label','staff.cat.volume_copy_creator.edit_then_create.btn.label'); + set_attr('EditThenCreate','accesskey','staff.cat.volume_copy_creator.edit_then_create.btn.accesskey'); + set_attr('CreateWithDefaults','label','staff.cat.volume_copy_creator.create_with_defaults.btn.label'); + set_attr('CreateWithDefaults','accesskey','staff.cat.volume_copy_creator.create_with_defaults.btn.accesskey'); } //g.error.sdump('D_ERROR','location.href = ' + location.href + '\n\ncopy_short cut = ' + g.copy_shortcut + '\n\nou_ids = ' + xul_param('ou_ids'));