implemented funding-source delete, v1
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 8 Apr 2008 22:03:55 +0000 (22:03 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 8 Apr 2008 22:03:55 +0000 (22:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9274 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js
Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html

index 26d64f3..b2b8da2 100644 (file)
@@ -92,5 +92,32 @@ openils.acq.FundingSource.create = function(fields, onCreateComplete) {
     req.send();
 };
 
+
+openils.acq.FundingSource.deleteFromGrid = function(grid, onComplete) {
+    var list = []
+    var selected = grid.selection.getSelected();
+    for(var rowIdx in selected) 
+        list.push(grid.model.getDatum(selected[rowIdx], 0));
+    openils.acq.FundingSource.deleteList(list, onComplete);
+};
+
+openils.acq.FundingSource.deleteList = function(list, onComplete) {
+    openils.acq.FundingSource._deleteList(list, 0, onComplete);
 }
 
+openils.acq.FundingSource._deleteList = function(list, idx, onComplete) {
+    if(idx >= list.length)    
+        return onComplete();
+    var ses = new OpenSRF.ClientSession('open-ils.acq');
+    var req = ses.request('open-ils.acq.funding_source.delete', oilsAuthtoken, list[idx]);
+    req.oncomplete = function(r) {
+        msg = r.recv()
+        stat = msg.content();
+        /* XXX CHECH FOR EVENT */
+        openils.acq.FundingSource._deleteList(list, ++idx, onComplete);
+    }
+    req.send();
+};
+
+
+} /* end dojo._hasResource[] */
index 46402a9..93d846d 100644 (file)
@@ -33,6 +33,7 @@
     }
 </script>
 
+<div class='oils-acq-actions-div'>
 <div dojoType="dijit.form.DropDownButton">
     <span>${('New Funding Source')}</span>
     <div dojoType="dijit.TooltipDialog" execute="createFS(arguments[0]);">
     </div>
 </div> 
 
+<button dojoType="dijit.form.Button" 
+        onclick="openils.acq.FundingSource.deleteFromGrid(fundingSourceGrid, function(){location.href = location.href})">
+    ${_('Delete Selected')}
+</button>
+
+</div>
+
 <div id='oils-acq-funding-source-grid'> </div>
 
 <script>
+    var fundingSourceGrid = null;
     function loadFSGrid() {
         dojo.require('openils.acq.FundingSource');
-        var fundingSourceGrid = null;
     
         var gridCols = [
             {name: '${_("ID")}', field: 'id'},