1 var records = new Array();
2 var ranks = new Array();
6 function mresultDoSearch() {
8 table = getId(config.ids.result.main_table);
9 rowtemplate = table.removeChild(getId(config.ids.result.row_template));
10 removeChildren(table);
12 if(getOffset() == 0 || getHitCount() == null ) {
18 mresultCollectRecords();
22 function mresultGetCount() {
23 var req = new Request(FETCH_MRCOUNT,
24 getStype(), getTerm(), getLocation(), getDepth(), getForm() );
25 req.callback( function(r) {
26 HITCOUNT = parseInt(r.getResultObject());
32 /* performs the actual search */
33 function mresultCollectIds() {
34 var req = new Request(FETCH_MRIDS, getStype(), getTerm(),
35 getLocation(), getDepth(), getDisplayCount(), getOffset(), getForm() );
36 req.callback( function(r) {
37 mresultSetRecords(r.getResultObject().ids);
38 mresultCollectRecords(); });
42 function mresultSetRecords(idstruct) {
44 for( var x = o; x!= idstruct.length + o; x++ ) {
45 records[x] = idstruct[x - o][0];
46 ranks[x] = idstruct[x - o][1];
51 function mresultCollectRecords() {
52 for( var x = getOffset(); x!= getDisplayCount() + getOffset(); x++ ) {
53 if(isNull(records[x])) break;
55 var req = new Request(FETCH_MRMODS, records[x]);
56 req.callback(function(r){
57 var rec = r.getResultObject();
58 resultDisplayRecord(rec, rowtemplate, true);
59 mresultCollectCopyCounts(rec);
64 if( x == (getDisplayCount() + getOffset()) - 1 ) {
65 getId(config.ids.result.top_div).appendChild(
66 getId(config.ids.result.nav_links).cloneNode(true));
72 function mresultCollectCopyCounts(rec) {
73 if(rec == null) return;
74 if(rec.doc_id() == null) return;
76 var req = new Request(FETCH_MR_COPY_COUNTS, getLocation(), rec.doc_id() );
77 req.callback(function(r){ mresultDisplayCopyCounts(rec, r.getResultObject()); });
81 function mresultDisplayCopyCounts(rec, copy_counts) {
82 if(copy_counts == null || rec == null) return;
84 while(copy_counts[i] != null) {
85 var cell = getId("copy_count_cell_" + i +"_" + rec.doc_id());
86 cell.appendChild(text(copy_counts[i].available + " / " + copy_counts[i].count));