some widget util functions
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Dec 2005 22:41:39 +0000 (22:41 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Dec 2005 22:41:39 +0000 (22:41 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2526 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/evergreen/util/widgets.js [new file with mode: 0644]

diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/util/widgets.js b/Open-ILS/xul/staff_client/chrome/content/evergreen/util/widgets.js
new file mode 100644 (file)
index 0000000..58b96bf
--- /dev/null
@@ -0,0 +1,32 @@
+dump('entering util/widgets.js\n');
+
+if (typeof util == 'undefined') var util = {};
+util.widgets = {};
+
+util.widgets.EXPORT_OK = [ 
+       'disable_accesskeys_in_node_and_children', 
+       'enable_accesskeys_in_node_and_children', 
+];
+util.widgets.EXPORT_TAGS       = { ':all' : util.widgets.EXPORT_OK };
+
+util.widgets.disable_accesskeys_in_node_and_children = function( node ) {
+       if (node.getAttribute('accesskeys')) {
+               node.setAttribute('oldaccesskeys', node.getAttribute('accesskeys'));
+               node.setAttribute('accesskeys','');
+       }
+       for (var i = 0; i < node.childNodes.length; i++) {
+               util.widgets.disable_accesskeys_in_node_and_children( node.childNodes[i] );
+       }
+}
+
+util.widgets.enable_accesskeys_in_node_and_children = function( node ) {
+       if (node.getAttribute('oldaccesskeys')) {
+               node.setAttribute('accesskeys', node.getAttribute('oldaccesskeys'));
+               node.setAttribute('oldaccesskeys','');
+       }
+       for (var i = 0; i < node.childNodes.length; i++) {
+               util.widgets.enable_accesskeys_in_node_and_children( node.childNodes[i] );
+       }
+}
+
+dump('exiting util/widgets.js\n');