[open-ils-commits] r11757 - trunk/Open-ILS/xul/staff_client/server/patron

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jan 7 13:29:29 EST 2009


Author: phasefx
Date: 2009-01-07 13:29:26 -0500 (Wed, 07 Jan 2009)
New Revision: 11757

Modified:
   trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
Log:
disable csp's in drop-down if they already exist

Modified: trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js	2009-01-07 17:35:13 UTC (rev 11756)
+++ trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js	2009-01-07 18:29:26 UTC (rev 11757)
@@ -62,6 +62,10 @@
                 var menuitem = document.createElement('menuitem'); csp_list.appendChild(menuitem);
                 menuitem.setAttribute('label',data.list.csp[i].label());
                 menuitem.setAttribute('value',data.list.csp[i].id());
+                menuitem.setAttribute('id','csp_'+data.list.csp[i].id());
+                if (util.functional.find_list( xulG.patron.standing_penalties(), function(o) { return o.standing_penalty().id() == data.list.csp[i].id(); } )) {
+                    menuitem.setAttribute('disabled','true');
+                }
                 menuitem.addEventListener(
                     'command',
                     function(ev) {
@@ -95,6 +99,7 @@
                                         }
                                     };
                                     rows[ req ] = list.append( row_params );
+                                    ev.target.setAttribute('disabled','true');
                                 }
                                 if (xulG && typeof xulG.refresh == 'function') {
                                     xulG.refresh();
@@ -131,6 +136,8 @@
                                     var parentNode = node.parentNode;
                                     parentNode.removeChild( node );
                                     delete(rows[ id ]);
+                                    var csp_id = typeof penalty.standing_penalty() == 'object' ? penalty.standing_penalty().id() : penalty.standing_penalty();
+                                    document.getElementById('csp_'+csp_id).setAttribute('disabled','false');
                                 }
                             } catch(E) {
                                 alert(E);



More information about the open-ils-commits mailing list