[open-ils-commits] r14649 - in trunk/Open-ILS/web: js/ui/default/conify/global/asset templates/default/conify/global/asset (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Oct 28 09:52:38 EDT 2009
Author: erickson
Date: 2009-10-28 09:52:36 -0400 (Wed, 28 Oct 2009)
New Revision: 14649
Modified:
trunk/Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js
trunk/Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2
Log:
turned location ordering into a drag-n-dop ui. TODO, plug in the Apply operation to delete and re-created order entries
Modified: trunk/Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js 2009-10-28 13:51:55 UTC (rev 14648)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js 2009-10-28 13:52:36 UTC (rev 14649)
@@ -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 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 filterGrid(org) {
orders = pcrud.search('acplo', {org : org}, {order_by : {acplo : 'position'}});
locations = pcrud.search('acpl', {owning_lib : org}); //TODO
- alert(locations.length);
+ source.selectAll();
+ source.deleteSelectedNodes();
+ source.clearItems();
- while(tbody.childNodes[0])
- tbody.removeChild(tbody.childNodes[0]);
-
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()+')'
+ ]);
}
);
}
Modified: trunk/Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2 2009-10-28 13:51:55 UTC (rev 14648)
+++ trunk/Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2 2009-10-28 13:52:36 UTC (rev 14649)
@@ -1,14 +1,11 @@
[% WRAPPER default/base.tt2 %]
[% ctx.page_title = 'Copy Location Order' %]
<script src='[% ctx.media_prefix %]/js/ui/default/conify/global/asset/copy_location_order.js'> </script>
+<link rel='stylesheet' type='text/css' href='[% ctx.media_prefix %]/js/dojo/dojo/resources/dnd.css'></link>
<div dojoType="dijit.layout.ContentPane" layoutAlign="client" class='oils-header-panel'>
<div>Copy Location Order</div>
<div>
- <!--
- <button dojoType='dijit.form.Button' onClick='acplGrid.showCreateDialog()'>New Location Order</button>
- <button dojoType='dijit.form.Button' onClick='acplGrid.deleteSelected()'>Delete Selected</button>
- -->
</div>
</div>
@@ -19,18 +16,11 @@
searchAttr='shortname'
labelAttr='shortname'>
</select>
+ <button dojoType='dijit.form.Button' onClick='applyChanges()'>Apply Changes</button>
</div>
<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
- <table>
- <thead><tr><th>Name</th><th>Owning Lib</th></thead>
- <tbody id='acpl-tbody'>
- <tr id='acpl-tr'>
- <td><span name='name'/></td>
- <td><span name='owning_lib'/></td>
- </tr>
- </tbody>
- </table>
+ <ol id='acl-ol'></ol>
</div>
[% END %]
More information about the open-ils-commits
mailing list