From: erickson Date: Wed, 17 Dec 2008 20:24:04 +0000 (+0000) Subject: added delete functionality. fixed some tabbing X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7e39c3b323eadd3830b25f196b91a0efbcc9b930;p=Evergreen.git added delete functionality. fixed some tabbing git-svn-id: svn://svn.open-ils.org/ILS/trunk@11606 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js b/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js index 6aef571f68..4a58f9a308 100644 --- a/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js +++ b/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js @@ -11,15 +11,15 @@ function buildCMGrid() { cmGrid.render(); fieldmapper.standardRequest( - ['open-ils.permacrud', 'open-ils.permacrud.search.ccm'], - { async: true, - params: [openils.User.authtoken, {code:{'!=':null}}], - onresponse: function (r) { + ['open-ils.permacrud', 'open-ils.permacrud.search.ccm'], + { async: true, + params: [openils.User.authtoken, {code:{'!=':null}}], + onresponse: function (r) { if(obj = openils.Util.readResponse(r)) { store.newItem(ccm.itemToStoreData(obj)); cmCache[obj.code()] = obj; } - } + } } ); } @@ -58,6 +58,32 @@ function cmCreate(args) { ); } - +function deleteFromGrid() { + _deleteFromGrid(cmGrid.selection.getSelected(), 0); +} + +function _deleteFromGrid(list, idx) { + if(idx >= list.length) // we've made it through the list + return; + + var item = list[idx]; + + fieldmapper.standardRequest( + ['open-ils.permacrud', 'open-ils.permacrud.delete.ccm'], + { async: true, + params: [openils.User.authtoken, item.code], + oncomplete: function(r) { + if(stat = openils.Util.readResponse(r)) { + // delete succeeded, remove it from the grid and the local cache + cmGrid.store.deleteItem(item); + delete cmCache[item.code]; + } + _deleteFromGrid(list, ++idx); + } + } + ); +} + openils.Util.addOnLoad(buildCMGrid); + diff --git a/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2 b/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2 index 50e0890e11..4c8c9d9e7b 100644 --- a/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2 +++ b/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2 @@ -50,12 +50,15 @@ + +
- +
CodeNameName Description SIP2 Media Type Magnetic Media