[open-ils-commits] r12640 - in trunk/Open-ILS/web: css/skin/default js/ui/default/acq/common templates/default/acq/common (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Mar 22 12:22:45 EDT 2009


Author: erickson
Date: 2009-03-22 12:22:43 -0400 (Sun, 22 Mar 2009)
New Revision: 12640

Modified:
   trunk/Open-ILS/web/css/skin/default/acq.css
   trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
   trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
Log:
added batch update for copies

Modified: trunk/Open-ILS/web/css/skin/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/acq.css	2009-03-21 19:14:33 UTC (rev 12639)
+++ trunk/Open-ILS/web/css/skin/default/acq.css	2009-03-22 16:22:43 UTC (rev 12640)
@@ -101,4 +101,3 @@
 #acq-lit-li-details-table td {padding:0px 10px 0px 10px;}
 #acq-lit-li-details-table th {padding:0px 10px 0px 10px; font-weight:bold;}
 .acq-lit-li-menu-bar {width:99%; text-align:left; border:1px solid #aaa; margin:5px 0px 10px 0px;}
-

Modified: trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2009-03-21 19:14:33 UTC (rev 12639)
+++ trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2009-03-22 16:22:43 UTC (rev 12640)
@@ -18,6 +18,7 @@
     this.rowTemplate = this.tbody.removeChild(dojo.byId('acq-lit-row'));
     this.copyTbody = dojo.byId('acq-lit-li-details-tbody');
     this.copyRow = this.copyTbody.removeChild(dojo.byId('acq-lit-li-details-row'));
+    this.copyBatchRow = dojo.byId('acq-lit-li-details-batch-row');
 
     dojo.byId('acq-lit-select-toggle').onclick = function(){self.toggleSelect()};
     dojo.byId('acq-lit-info-back-button').onclick = function(){self.show('list')};
@@ -186,10 +187,34 @@
 
     this.drawCopies = function(liId) {
         this.show('copies');
+        var self = this;
         this.copyCache = {};
+        this.copyWidgetCache = {};
+        this.copyBatchWidgets = {};
         acqLitSaveCopies.onClick = function() { self.saveCopyChanges(liId) };
+        acqLitBatchUpdateCopies.onClick = function() { self.batchCopyUpdate() };
+
         while(this.copyTbody.childNodes[0])
             this.copyTbody.removeChild(this.copyTbody.childNodes[0]);
+
+        var row = this.copyBatchRow;
+        if(!this.copyBatchRowDrawn) {
+            dojo.forEach(['fund', 'owning_lib', 'location'],
+                function(field) {
+                    var widget = new openils.widget.AutoFieldWidget({
+                        fmField : field,
+                        fmClass : 'acqlid',
+                        parentNode : dojo.query('[name='+field+']', row)[0],
+                        orgLimitPerms : ['CREATE_PICKLIST'],
+                    });
+                    widget.build();
+                    self.copyBatchWidgets[field] = widget.widget;
+                }
+            );
+            this.copyBatchRowDrawn = true;
+        };
+
+
         openils.acq.Lineitem.fetchAttrDefs(
             function() { 
                 self._fetchLineitem(liId, function(li){self._drawCopies(li);}); 
@@ -197,6 +222,17 @@
         );
     };
 
+    this.batchCopyUpdate = function() {
+        var self = this;
+        var fields = ['fund', 'owning_lib', 'location'];
+        for(var k in this.copyWidgetCache) {
+            var cache = this.copyWidgetCache[k];
+            dojo.forEach(fields, function(f) {
+                var newval = self.copyBatchWidgets[f].attr('value');
+                if(newval) cache[f].attr('value', newval);
+            });
+        }
+    };
 
     this._drawCopies = function(li) {
         acqLitAddCopyCount.onClick = function() { 
@@ -219,6 +255,7 @@
     this.addCopy = function(li, copy) {
         var row = this.copyRow.cloneNode(true);
         this.copyTbody.appendChild(row);
+        var self = this;
 
         if(!copy) {
             copy = new fieldmapper.acqlid();
@@ -229,6 +266,7 @@
 
         this.copyCache[copy.id()] = copy;
         row.setAttribute('copy_id', copy.id());
+        self.copyWidgetCache[copy.id()] = {};
 
         dojo.forEach(['fund', 'owning_lib', 'location', 'barcode', 'cn_label'],
             function(field) {
@@ -249,10 +287,10 @@
                         }
                     }
                 );
+                self.copyWidgetCache[copy.id()][field] = widget.widget;
             }
         );
 
-        var self = this;
         dojo.query('[name=delete]', row)[0].onclick = 
             function() { self.deleteCopy(row) };
     };

Modified: trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2009-03-21 19:14:33 UTC (rev 12639)
+++ trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2009-03-22 16:22:43 UTC (rev 12640)
@@ -82,6 +82,7 @@
     <!-- Copies table -->
     <div id='acq-lit-li-details' class='hidden'>
         <h2>Copies</h2>
+
         <div class='acq-lit-li-menu-bar'>
             <table style='width:100%'>
                 <tr>
@@ -107,16 +108,27 @@
         </div>
 
         <table id='acq-lit-li-details-table'>
-            <thead>
+            <tbody style='background-color:#ddd;'>
+                <tr id='acq-lit-li-details-batch-row'>
+                    <td><div name='owning_lib'/></td>
+                    <td><div name='location'/></td>
+                    <td><div name='fund'/></td>
+                    <td colspan='3' style='text-align:left;'>
+                        <div dojoType='dijit.form.Button' jsId='acqLitBatchUpdateCopies'>Batch Update</div>
+                    </td>
+                </tr>
+            </tbody>
+            <tbody><tr><td colspan='0' style='height:20px;'/></tr></tbody>
+            <tbody style='font-weight:bold;'>
                 <tr>
-                    <th>Owning Branch</th>
-                    <th>Shelving Location</th>
-                    <th>Fund</th>
-                    <th>Barcode</th>
-                    <th>Callnumber</th>
-                    <th/>
+                    <td style='margin-top:30px;'>Owning Branch</td>
+                    <td>Shelving Location</td>
+                    <td>Fund</td>
+                    <td>Barcode</td>
+                    <td>Callnumber</td>
+                    <td/>
                 </tr>
-            </thead>
+            </tbody>
             <tbody id='acq-lit-li-details-tbody'>
                 <tr id='acq-lit-li-details-row'>
                     <td><div name='owning_lib'/></td>



More information about the open-ils-commits mailing list