From: phasefx Date: Thu, 24 Sep 2009 01:34:37 +0000 (+0000) Subject: get_text counterpart of set_text. abstracts away the widget type involved X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=56bc6cd6697addc302e8ebd51e495002f42534e5;p=contrib%2FConifer.git get_text counterpart of set_text. abstracts away the widget type involved git-svn-id: svn://svn.open-ils.org/ILS/trunk@14136 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/widgets.js b/Open-ILS/xul/staff_client/chrome/content/util/widgets.js index 259add0084..74681cf175 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/widgets.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/widgets.js @@ -318,6 +318,30 @@ util.widgets.set_text = function(n,t) { } } +util.widgets.get_text = function(n) { + n = util.widgets.get(n); + switch(n.nodeName) { + case 'button' : + case 'caption' : + return n.getAttribute('label'); + break; + case 'label' : + return n.getAttribute('value'); + break; + case 'description' : + case 'H1': case 'H2': case 'H3': case 'H4': case 'SPAN': case 'P': case 'BLOCKQUOTE': + return n.textContent; + break; + case 'textbox' : + return n.value; + break; + default: + alert("FIXME: util.widgets.get_text doesn't know how to handle " + n.nodeName); + return null; + break; + } +} + util.widgets.save_attributes = function (file,ids_attrs) { try { var blob = {};