[open-ils-commits] r14136 - trunk/Open-ILS/xul/staff_client/chrome/content/util (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Sep 23 21:34:39 EDT 2009


Author: phasefx
Date: 2009-09-23 21:34:37 -0400 (Wed, 23 Sep 2009)
New Revision: 14136

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
Log:
get_text counterpart of set_text.  abstracts away the widget type involved

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/widgets.js	2009-09-23 23:36:55 UTC (rev 14135)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/widgets.js	2009-09-24 01:34:37 UTC (rev 14136)
@@ -318,6 +318,30 @@
 	}
 }
 
+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 = {};



More information about the open-ils-commits mailing list