alert(this._.TERM_LIMIT);
return;
}
- var data = this.parseUnimaginatively(
+ var data = this[
+ this.parseCSV ? "parseAsCSV" : "parseUnimaginatively"
+ ](
openils.XUL.contentFromFileOpenDialog(
this._.CHOOSE_FILE, this.args.fileSizeLimit
)
);
+
if (data.length + this.terms.length >=
this.args.termLimit) {
alert(this._.TERM_LIMIT_SOME);
alert(E);
}
},
+ "parseAsCSV": function(data) {
+ return this.parseUnimaginatively(data).
+ map(
+ function(o) {
+ return o.match(/^".+"$/) ? o.slice(1,-1) : o;
+ }
+ ).
+ filter(
+ function(o) { return Boolean(o.match(/^\d+$/)); }
+ );
+ },
"parseUnimaginatively": function(data) {
if (!data) return [];
else return data.split("\n").
var usingPl = null;
function fetchRecords() {
- var data = termLoader.attr("value");
+ var data = openils.Util.uniqueElements(termLoader.attr("value"));
var result_count = 0;
- pager.total = data.length;
+ // Don't show a total for now... This total is the total number of
+ // search terms, but a user would take it to mean the total number of
+ // results, which we don't have a straightfoward way of getting without
+ // doing the search more that once.
+
+ // pager.total = data.length;
progressDialog.show(true);
fieldmapper.standardRequest(
function init() {
new openils.widget.XULTermLoader(
- {"parentNode": "acq-frombib-upload"}
+ {"parentNode": "acq-frombib-upload", "parseCSV": true}
).build(function(w) { termLoader = w; });
liTable = new AcqLiTable();
pager = new LiTablePager(fetchRecords, liTable);