[open-ils-commits] r11680 - in trunk/Open-ILS/web: js/ui/default/conify/global/config templates/default/conify/global/config

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Dec 26 11:52:20 EST 2008


Author: erickson
Date: 2008-12-26 11:52:17 -0500 (Fri, 26 Dec 2008)
New Revision: 11680

Modified:
   trunk/Open-ILS/web/js/ui/default/conify/global/config/standing_penalty.js
   trunk/Open-ILS/web/templates/default/conify/global/config/standing_penalty.tt2
Log:
augmented penalty block list widget to automatically return the formated value

Modified: trunk/Open-ILS/web/js/ui/default/conify/global/config/standing_penalty.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/config/standing_penalty.js	2008-12-26 14:01:03 UTC (rev 11679)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/config/standing_penalty.js	2008-12-26 16:52:17 UTC (rev 11680)
@@ -31,7 +31,7 @@
     var penalty = new csp();
     penalty.name(args.name);
     penalty.label(args.label);
-    penalty.block_list(formatBlockList(args.block_list)); 
+    penalty.block_list(args.block_list); 
 
     fieldmapper.standardRequest(
         ['open-ils.permacrud', 'open-ils.permacrud.create.csp'],
@@ -44,22 +44,10 @@
         }
     );
 }
-
-function formatBlockList(list) {
-    var str = '';
-    for(var idx in list)
-        str += list[idx] + '|';
-    return  str.replace(/\|$/, '');  
-}
-
 function spGridChanged(item, attr, oldVal, newVal) {
     var sp = spCache[spGrid.store.getValue(item, 'id')];
     console.log("changing cm " + sp.id() + " object: " + attr + " = " + newVal);
-    if(attr == 'block_list') {
-        sp[attr](formatBlockList(newVal));
-    } else {
-        sp[attr](newVal);
-    }
+    sp[attr](newVal);
     sp.ischanged(true);
     spSaveButton.setDisabled(false);
 }
@@ -121,15 +109,15 @@
 
     fieldmapper.standardRequest(
        ['open-ils.permacrud', 'open-ils.permacrud.delete.csp'],
-       {   async: true,
-           params: [openils.User.authtoken, id],
-           oncomplete: function(r) {
-           if(obj = openils.Util.readResponse(r)) {
-               spGrid.store.deleteItem(item);
-           }
-           _deleteFromGrid(list, ++idx);
-           }
-       }
+       {    async: true,
+            params: [openils.User.authtoken, id],
+            oncomplete: function(r) {
+                if(obj = openils.Util.readResponse(r)) {
+                    spGrid.store.deleteItem(item);
+                }
+                _deleteFromGrid(list, ++idx);
+            }
+        }
     );
 }
 

Modified: trunk/Open-ILS/web/templates/default/conify/global/config/standing_penalty.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/config/standing_penalty.tt2	2008-12-26 14:01:03 UTC (rev 11679)
+++ trunk/Open-ILS/web/templates/default/conify/global/config/standing_penalty.tt2	2008-12-26 16:52:17 UTC (rev 11680)
@@ -19,6 +19,17 @@
                     this.addOption({value:'CIRC', label:'CIRC'});
                     this.addOption({value:'RENEW', label:'RENEW'});
                     this.addOption({value:'HOLD', label:'HOLD'});
+                },
+                attr : function(name, value) {
+                    if(name == 'value' && value == null) {
+                        var val = this.inherited('attr', arguments);
+                        var str = '';
+                        for(var i in val)
+                            str += val[i] + '|';
+                        return str.substring(0, str.length - 1);
+                    } else {
+                        return this.inherited('attr', arguments);
+                    } 
                 }
             } 
         );
@@ -66,7 +77,7 @@
                         cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Label</th>
                     <th field="block_list" width='auto' editable='true' 
                         cellType='dojox.grid.cells._Widget'
-                        widgetClass='openils.widget.StandingPenaltyBlockedSelector' jsId='formatBlockList'>Block List</th>
+                        widgetClass='openils.widget.StandingPenaltyBlockedSelector'>Block List</th>
                 </tr>
             </thead>
         </table>    



More information about the open-ils-commits mailing list