[open-ils-commits] r17707 - trunk/Open-ILS/xul/staff_client/server/cat (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 15 16:09:37 EDT 2010
Author: phasefx
Date: 2010-09-15 16:09:32 -0400 (Wed, 15 Sep 2010)
New Revision: 17707
Modified:
trunk/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js
Log:
refactoring for readability
Modified: trunk/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js 2010-09-15 20:04:55 UTC (rev 17706)
+++ trunk/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js 2010-09-15 20:09:32 UTC (rev 17707)
@@ -29,16 +29,25 @@
// 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'));
More information about the open-ils-commits
mailing list