[open-ils-commits] r12922 - in trunk/Open-ILS/web: js/ui/default/acq/picklist templates/default/acq/picklist (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Apr 20 14:33:39 EDT 2009
Author: erickson
Date: 2009-04-20 14:33:33 -0400 (Mon, 20 Apr 2009)
New Revision: 12922
Modified:
trunk/Open-ILS/web/js/ui/default/acq/picklist/view_list.js
trunk/Open-ILS/web/templates/default/acq/picklist/list.tt2
Log:
ported picklist page to autogrid for consistency
Modified: trunk/Open-ILS/web/js/ui/default/acq/picklist/view_list.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/picklist/view_list.js 2009-04-20 18:32:57 UTC (rev 12921)
+++ trunk/Open-ILS/web/js/ui/default/acq/picklist/view_list.js 2009-04-20 18:33:33 UTC (rev 12922)
@@ -1,4 +1,5 @@
-dojo.require('dojox.grid.DataGrid');
+//dojo.require('dojox.grid.DataGrid');
+dojo.require('openils.widget.AutoGrid');
dojo.require('dojo.data.ItemFileWriteStore');
dojo.require('dijit.Dialog');
dojo.require('dijit.form.Button');
@@ -21,22 +22,15 @@
if(listAll)
method = method.replace(/user/, 'user.all');
- var store = new dojo.data.ItemFileWriteStore({data:acqpl.initStoreData()});
- plListGrid.setStore(store);
- plListGrid.render();
-
fieldmapper.standardRequest(
['open-ils.acq', method],
-
{ async: true,
- params: [openils.User.authtoken,
- {flesh_lineitem_count:1, flesh_owner:1}],
-
+ params: [openils.User.authtoken, {flesh_lineitem_count:1, flesh_owner:1}],
onresponse : function(r) {
- if(pl = openils.Util.readResponse(r)) {
- plCache[pl.id()] = pl;
- store.newItem(acqpl.toStoreItem(pl));
- }
+ var pl = openils.Util.readResponse(r);
+ if(!pl) return;
+ plCache[pl.id()] = pl;
+ plListGrid.store.newItem(acqpl.toStoreItem(pl));
},
}
);
@@ -78,22 +72,23 @@
return dojo.date.locale.format(date, {formatLength:'short'});
}
function deleteFromGrid() {
- var list = []
- var selected = plListGrid.selection.getSelected();
- for(var idx = 0; idx < selected.length; idx++) {
- var item = selected[idx];
- list.push(item.id);
- plListGrid.store.deleteItem(item);
- }
- openils.acq.Picklist.deleteList(list);
+ progressDialogInd.show();
+ var list = [];
+ dojo.forEach(
+ plListGrid.getSelectedItems(),
+ function(item) {
+ list.push(plListGrid.store.getValue(item, 'id'));
+ plListGrid.store.deleteItem(item);
+ }
+ );
+ openils.acq.Picklist.deleteList(list, function(){progressDialogInd.hide();});
}
function cloneSelectedPl(fields) {
- var selected = plListGrid.selection.getSelected();
- if(selected.length == 0 || !(fields.name)) return;
+ var item = plListGrid.getSelectedItems()[0];
+ if(!item) return;
- var item = selected[0]; // clone the first selected
var plId = plListGrid.store.getValue(item, 'id');
var entryCount = Number(plListGrid.store.getValue(item, 'entry_count'));
@@ -125,11 +120,13 @@
function loadLeadPlSelector() {
var store = new dojo.data.ItemFileWriteStore({data:acqpl.initStoreData()});
- var selected = plListGrid.selection.getSelected();
- dojo.forEach(selected, function(item) {
- var pl = plCache[plListGrid.store.getValue(item, 'id')];
- store.newItem(fieldmapper.acqpl.toStoreItem(pl));
- });
+ dojo.forEach(
+ plListGrid.getSelectedItems(),
+ function(item) {
+ var pl = plCache[plListGrid.store.getValue(item, 'id')];
+ store.newItem(fieldmapper.acqpl.toStoreItem(pl));
+ }
+ );
plMergeLeadSelector.store = store;
plMergeLeadSelector.startup();
}
@@ -139,19 +136,21 @@
var ids = [];
var totalLi = 0;
- var selected = plListGrid.selection.getSelected();
var leadPl = plCache[fields.lead];
var leadPlItem;
- dojo.forEach(selected, function(item) {
- var id = plListGrid.store.getValue(item, 'id');
- if(id == fields.lead) {
- leadPlItem = item;
- return;
+ dojo.forEach(
+ plListGrid.getSelectedItems(),
+ function(item) {
+ var id = plListGrid.store.getValue(item, 'id');
+ if(id == fields.lead) {
+ leadPlItem = item;
+ return;
+ }
+ totalLi += new Number(plListGrid.store.getValue(item, 'entry_count'));
+ ids.push(id);
}
- totalLi += new Number(plListGrid.store.getValue(item, 'entry_count'));
- ids.push(id);
- });
+ );
progressDialog.show();
progressDialog.update({maximum:totalLi, progress:0});
@@ -171,11 +170,14 @@
plListGrid.store.setValue(leadPlItem, 'entry_count', leadPl.entry_count());
// remove the deleted lists from the grid
- dojo.forEach(selected, function(item) {
- var id = plListGrid.store.getValue(item, 'id');
- if(id != fields.lead)
- plListGrid.store.deleteItem(item);
- });
+ dojo.forEach(
+ plListGrid.getSelectedItems(),
+ function(item) {
+ var id = plListGrid.store.getValue(item, 'id');
+ if(id != fields.lead)
+ plListGrid.store.deleteItem(item);
+ }
+ );
}
}
}
Modified: trunk/Open-ILS/web/templates/default/acq/picklist/list.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/picklist/list.tt2 2009-04-20 18:32:57 UTC (rev 12921)
+++ trunk/Open-ILS/web/templates/default/acq/picklist/list.tt2 2009-04-20 18:33:33 UTC (rev 12922)
@@ -50,8 +50,6 @@
</div>
</div>
- <button dojoType="dijit.form.Button" onclick="deleteFromGrid();">Delete Selected</button>
-
<div dojoType="dijit.form.DropDownButton">
<span>Clone Selected</span>
<div dojoType="dijit.TooltipDialog" execute="cloneSelectedPl(arguments[0]);">
@@ -86,20 +84,26 @@
</div>
</div>
+ <button dojoType="dijit.form.Button" onclick="deleteFromGrid();">Delete Selected</button>
+
</div>
<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
<div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
- <table jsId="plListGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
+ <table
+ jsId="plListGrid"
+ dojoType="openils.widget.AutoGrid"
+ query="{id: '*'}"
+ fieldOrder="['name', 'owner', 'entry_count', 'create_time', 'edit_time']"
+ suppressFields="['editor', 'creator']"
+ query="{id: '*'}"
+ defaultCellWidth='"auto"'
+ fmClass='acqpl'
+ editOnEnter='true'>
<thead>
<tr>
- <th field="id">ID</th>
- <th field="name" width='auto' editable='true'
- cellType='dojox.grid.cells._Widget'
- widgetClass='dijit.form.TextBox' formatter='formatName'>Name</th>
- <th field="owner" get='getOwnerName'>Selector</th>
- <th field="create_time" width='auto' get='getDateTimeField'>Create Time</th>
- <th field="edit_time" width='auto' get='getDateTimeField'>Edit Time</th>
+ <th field="name" formatter='formatName'/>
+ <th field="owner" get='getOwnerName'/>
<th field="entry_count">Entry Count</th>
</tr>
</thead>
@@ -108,5 +112,6 @@
</div>
<div class='hidden'><div jsId='progressDialog' dojoType='openils.widget.ProgressDialog'/></div>
+<div class='hidden'><div jsId='progressDialogInd' dojoType='openils.widget.ProgressDialog' indeterminate='true'/></div>
[% END %]
More information about the open-ils-commits
mailing list