2 function resultSetInfo() {
4 if( getDisplayCount() > (getHitCount() - getOffset())) c = getHitCount();
5 else c = getDisplayCount() + getOffset();
7 var pages = parseInt(getHitCount() / getDisplayCount()) + 1;
8 G.ui.result.current_page.appendChild(text( (getOffset()/getDisplayCount()) + 1));
9 G.ui.result.num_pages.appendChild(text(pages + ")"));
13 if( !((o + getDisplayCount()) >= getHitCount()) ) {
16 args[PARAM_OFFSET] = o + getDisplayCount();
17 G.ui.result.next_link.setAttribute("href", buildOPACLink(args));
18 addCSSClass(G.ui.result.next_link, config.css.result.nav_active);
20 args[PARAM_OFFSET] = getHitCount() - (getHitCount() % getDisplayCount());
21 G.ui.result.end_link.setAttribute("href", buildOPACLink(args));
22 addCSSClass(G.ui.result.end_link, config.css.result.nav_active);
28 args[PARAM_OFFSET] = o - getDisplayCount();
29 G.ui.result.prev_link.setAttribute( "href", buildOPACLink(args));
30 addCSSClass(G.ui.result.prev_link, config.css.result.nav_active);
32 args[PARAM_OFFSET] = 0;
33 G.ui.result.home_link.setAttribute( "href", buildOPACLink(args));
34 addCSSClass(G.ui.result.home_link, config.css.result.nav_active);
37 G.ui.result.offset_start.appendChild(text(o + 1));
38 G.ui.result.offset_end.appendChild(text(c));
39 G.ui.result.result_count.appendChild(text(getHitCount()));
45 function resultDisplayRecord(rec, rowtemplate, is_mr) {
47 if(rec == null) rec = new mvr(); /* if we return we won't build some important UI components */
49 /* hide the 'now loading...' message */
50 hideMe(G.ui.all.loading);
52 var r = rowtemplate.cloneNode(true);
54 var pic = findNodeByName(r, config.names.result.item_jacket);
55 pic.setAttribute("src", buildISBNSrc(cleanISBN(rec.isbn())));
58 var title_link = findNodeByName(r, config.names.result.item_title);
59 var author_link = findNodeByName(r, config.names.result.item_author);
61 if( is_mr ) buildTitleLink(rec, title_link);
62 buildAuthorLink(rec, author_link);
64 var countsrow = findNodeByName(r, config.names.result.counts_row);
66 /* adjust the width according to how many org counts are added */
67 findNodeByName(r, "result_table_title_cell").width =
68 resultAddCopyCounts(countsrow, rec) + "%";
75 /* -------------------------------------------------------------------- */
76 /* dynamically add the copy count rows based on the org type
77 'countsrow' is the row into which we will add TD's to hold
79 This code generates copy count cells with an id of
81 'copy_count_cell_<depth>_<record_id>' for later insertion
84 return the percent width left over after the each count is added.
85 if 3 counts are added, returns 100 - (cell.width * 3)
88 function resultAddCopyCounts(countsrow, rec) {
90 var ccell = findNodeByName(countsrow, config.names.result.count_cell);
93 var nodes = orgNodeTrail(findOrgUnit(getLocation()));
95 var type = findOrgType(node.ou_type());
96 ccell.id = "copy_count_cell_" + type.depth() + "_" + rec.doc_id();
97 ccell.title = type.opac_label();
98 addCSSClass(ccell, "copy_count_cell_even");
101 var lastcell = ccell;
106 var d = findOrgDepth(nodes[1]);
107 var d2 = findOrgDepth(nodes[nodes.length -1]);
109 for( var i = d; i <= d2 ; i++ ) {
111 ccell = ccell.cloneNode(true);
114 removeCSSClass(ccell, "copy_count_cell_even");
116 addCSSClass(ccell, "copy_count_cell_even");
118 var node = nodes[x++];
119 var type = findOrgType(node.ou_type());
121 ccell.id = "copy_count_cell_" + type.depth() + "_" + rec.doc_id();
122 ccell.title = type.opac_label();
123 countsrow.insertBefore(ccell, lastcell);
129 return 100 - (nodes.length * 8);