},
"parseUnimaginatively": function(data) {
if (!data) return [];
- else return data.split(/[\n, ]/).filter(
- function(o) { return o.length > 0; }
- );
+ else return data.split("\n").
+ filter(function(o) { return o.length > 0; }).
+ map(function(o) { return o.split(",")[0] }).
+ filter(function(o) { return o.length > 0; });
}
}
);
dojo.byId('acq-lit-notes-back-button').onclick = function(){self.show('list')};
dojo.byId('acq-lit-real-copies-back-button').onclick = function(){self.show('list')};
- this.reset = function() {
+ this.reset = function(keep_selectors) {
while(self.tbody.childNodes[0])
self.tbody.removeChild(self.tbody.childNodes[0]);
- self.selectors = [];
self.noteAcks = {};
self.relCache = {};
+
+ if (!keep_selectors)
+ self.selectors = [];
};
this.setNext = function(handler) {
/** @param all If true, assume all are selected */
this.getSelected = function(all) {
var selected = [];
+ var indices = {}; /* use to uniqify. needed in paging situations. */
dojo.forEach(self.selectors,
function(i) {
if(i.checked || all)
- selected.push(self.liCache[i.parentNode.parentNode.getAttribute('li')]);
+ indices[i.parentNode.parentNode.getAttribute('li')] = true;
}
);
- return selected;
+ return openils.Util.objectProperties(indices).map(
+ function(liId) { return self.liCache[liId]; }
+ );
};
this.setRowAttr = function(td, liWrapper, field, type) {
[this.batch, this.total] = this.fetcher(this.offset, this.limit);
if (this.batch.length) {
- this.liTable.reset();
+ this.liTable.reset(/* keep_selectors */ true);
this.liTable.show("list");
this.batch.forEach(function(li) { self.liTable.addLineitem(li); });
}