[open-ils-commits] r8205 -
branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Dec 13 10:47:33 EST 2007
Author: phasefx
Date: 2007-12-13 10:26:46 -0500 (Thu, 13 Dec 2007)
New Revision: 8205
Modified:
branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
Log:
robustify these
Modified: branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util/widgets.js 2007-12-12 14:35:34 UTC (rev 8204)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/chrome/content/util/widgets.js 2007-12-13 15:26:46 UTC (rev 8205)
@@ -324,9 +324,15 @@
for (var element_id in ids_attrs) {
var attribute_list = ids_attrs[ element_id ];
if (! blob[ element_id ] ) blob[ element_id ] = {};
- for (var j = 0; j < attribute_list.length; j++) {
- blob[ element_id ][ attribute_list[j] ] = document.getElementById( element_id ).getAttribute( attribute_list[j] );
- }
+ var x = document.getElementById( element_id );
+ if (x) {
+ for (var j = 0; j < attribute_list.length; j++) {
+ blob[ element_id ][ attribute_list[j] ] = x.getAttribute( attribute_list[j] );
+ }
+ } else {
+ dump('Error in util.widgets.save_attributes('+file._file.path+','+js2JSON(ids_attrs)+'):\n');
+ dump('\telement_id = ' + element_id + '\n');
+ }
}
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
//FIXME - WHY DOES THIS NOT WORK?// JSAN.use('util.file'); var file = new util.file(filename);
@@ -344,7 +350,15 @@
var blob = file.get_object(); file.close();
for (var element_id in blob) {
for (var attribute in blob[ element_id ]) {
- document.getElementById( element_id ).setAttribute(attribute, blob[ element_id ][ attribute ]);
+ var x = document.getElementById( element_id );
+ if (x) {
+ x.setAttribute(attribute, blob[ element_id ][ attribute ]);
+ } else {
+ dump('Error in util.widgets.load_attributes('+file._file.path+'):\n');
+ dump('\telement_id = ' + element_id + '\n');
+ dump('\tattribute = ' + attribute + '\n');
+ dump('\tblob[id][attr] = ' + blob[element_id][attribute] + '\n');
+ }
}
}
return blob;
More information about the open-ils-commits
mailing list