From c0d04be4a452a1df8d675497eefabd7ea3b26e7f Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 28 Oct 2009 13:52:36 +0000 Subject: [PATCH] turned location ordering into a drag-n-dop ui. TODO, plug in the Apply operation to delete and re-created order entries git-svn-id: svn://svn.open-ils.org/ILS/trunk@14649 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../global/asset/copy_location_order.js | 25 ++++++++----------- .../global/asset/copy_location_order.tt2 | 16 +++--------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js b/Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js index d23d541beb..be177e3bbf 100644 --- a/Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js +++ b/Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js @@ -1,4 +1,6 @@ dojo.require('dijit.layout.ContentPane'); +dojo.require("dojo.dnd.Container"); +dojo.require("dojo.dnd.Source"); dojo.require('openils.widget.OrgUnitFilteringSelect'); dojo.require('fieldmapper.OrgUtils'); dojo.require('openils.User'); @@ -10,16 +12,13 @@ var user; var pcrud; var orders; var locations; -var tbody; -var template; +var source; function init() { user = new openils.User(); pcrud = new openils.PermaCrud({authtoken : user.authtoken}); - tbody = dojo.byId('acpl-tbody'); - template = tbody.removeChild(dojo.byId('acpl-tr')); - + source = new dojo.dnd.Source('acl-ol'); user.buildPermOrgSelector( 'ADMIN_COPY_LOCATION_ORDER', @@ -36,19 +35,15 @@ function init() { function filterGrid(org) { orders = pcrud.search('acplo', {org : org}, {order_by : {acplo : 'position'}}); locations = pcrud.search('acpl', {owning_lib : org}); //TODO - alert(locations.length); - - while(tbody.childNodes[0]) - tbody.removeChild(tbody.childNodes[0]); + source.selectAll(); + source.deleteSelectedNodes(); + source.clearItems(); dojo.forEach(locations, function(loc) { - var row = template.cloneNode(true); - dojo.query('[name=name]', row)[0].innerHTML = loc.name(); - dojo.query('[name=owning_lib]', row)[0].innerHTML = - fieldmapper.aou.findOrgUnit(loc.owning_lib()).shortname(); - tbody.appendChild(row); - console.log(row); + source.insertNodes(false, [ + loc.name() + ' (' + fieldmapper.aou.findOrgUnit(loc.owning_lib()).shortname()+')' + ]); } ); } diff --git a/Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2 b/Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2 index 6e914ba74d..6c2813a49d 100644 --- a/Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2 +++ b/Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2 @@ -1,14 +1,11 @@ [% WRAPPER default/base.tt2 %] [% ctx.page_title = 'Copy Location Order' %] +
Copy Location Order
-
@@ -19,18 +16,11 @@ searchAttr='shortname' labelAttr='shortname'> +
- - - - - - - - -
NameOwning Lib
+
    [% END %] -- 2.43.2