<style type="text/css">
- .date-input { width: 6em; }
+ .date-input { width: 7em; }
#headings-table th {
font-weight: bold;
background-color: white;
}
+ #mattype-select-container {
+ font-size: 120%;
+ position:fixed;
+ top: 0px;
+ right: 50px;
+ text-align:right;
+ padding: 4px 8px 4px 8px;
+ background-color: white;
+ border-radius: 0px 0px 8px 8px;
+ border: 2px solid #9ee7fa;
+ border-top: none;
+ border-right-radius: 0px;
+ }
+
+
#navigation-div {
background-color: #9ee7fa;
border-bottom: solid grey 1px;
padding: 3px;
}
+ #mattype-select-container option {
+ padding: 2px;
+ }
+
</style>
<div id='navigation-div-container'>
class='date-input' dojoType='dijit.form.DateTextBox'/></span>
<span>End Date: <input type='text' jsId='endDate'
class='date-input' dojoType='dijit.form.DateTextBox'/></span>
- <span><button id='apply-dates-btn'>Apply Dates</button></span>
+ <span><button id='apply-dates-btn'>Apply</button></span>
</div>
<div style='padding-left: 20px; padding-right: 20px; float:left'>|</div>
<div style='float:left'>
<div id='navigation-div-pad'></div>
</div>
+<div id='mattype-select-container'>
+ <div style='padding-bottom: 7px'>
+ <b>Excluded These Formats</b>
+ </div>
+ <div id='mattype-filter-template'>
+ <span name='mattype-name'></span>
+ <input name='mattype-checkbox' type='checkbox'/>
+ </div>
+</div>
+
<div id='below-nav-div'>
<div id='loading-indicator' class="hidden">
<td>From 245:</td>
<td><span name='bib_marc_245'></span></td>
</tr>
+ <tr>
+ <td>Format:</td>
+ <td><span name='mattype_label'></span></td>
</table>
</td>
</tr>
var template_row;
var cached_headings
var all_fetched;
+var mattypes = [];
+var mattype_container;
+var mattype_template;
// Force a minimum start date for new headings to avoid reporting on
// (practically) all headings, which occurs when the start date preceeds
dojo.byId('headings-row-template'));
}
+ if (!mattype_container) {
+ mattype_container = dojo.byId('mattype-select-container');
+ mattype_template = mattype_container.removeChild(
+ dojo.byId('mattype-filter-template'));
+ }
+
+ fetch_mattypes();
+
setup_paging();
dojo.byId('apply-dates-btn').onclick = function() {
endDate.attr('value', initDate);
}
+function fetch_mattypes() {
+
+ pcrud.search('ccvm', {ctype : 'mattype'}, {
+ order_by : {ccvm : ['value']},
+ async : true,
+ oncomplete : function(r) {
+ mattypes = openils.Util.readResponse(r);
+ dojo.forEach(mattypes, function(type) {
+ var row = mattype_template.cloneNode(true);
+ var namebox = openils.Util.getNodeByName('mattype-name', row);
+ var chkbox = openils.Util.getNodeByName('mattype-checkbox', row);
+ chkbox.setAttribute('code', type.code());
+ namebox.innerHTML = type.value();
+ // also modify checkbox by clicking on label
+ namebox.onclick = function() {chkbox.checked = !chkbox.checked}
+ mattype_container.appendChild(row);
+ });
+ }
+ });
+}
+
// Fetch headings.
// Limiting each pcrud query by browse_axis significantly speeds up
// the DB query, so fetch in order of display: author -> subject -> series.
/* cache 4 pages, plus 1 heading at a time */
var fetch_count = page_size * 4 + 1;
- pcrud.search('rcbe', compile_date_filter(), {
+ pcrud.search('rcbe', compile_query_filter(), {
offset : page_offset,
limit : fetch_count,
async : true,
});
}
-function compile_date_filter() {
+function compile_query_filter() {
start_date = startDate.attr('value');
end_date = endDate.attr('value');
end_date = openils.Util.getYMD(end_date);
}
- var date_filter = {}
+ var query_filter = {}
if (start_date && end_date) {
// use -and instead of BETWEEN so that end_date is not inclusive.
- date_filter['-and'] = [
+ query_filter['-and'] = [
{heading_date : {'>=' : start_date}},
{heading_date : {'<' : end_date}}
];
} else if (start_date) {
- date_filter.heading_date = {'>=' : start_date};
+ query_filter.heading_date = {'>=' : start_date};
} else {
- date_filter.heading_date = {'<' : end_date};
+ query_filter.heading_date = {'<' : end_date};
}
- return date_filter;
+ dojo.query('[name=mattype-checkbox]').forEach(function(chkbox) {
+ if (chkbox.checked) {
+ if (!query_filter.mattype)
+ query_filter.mattype = {'not in' : []};
+ query_filter.mattype['not in'].push(chkbox.getAttribute('code'));
+ }
+ });
+
+ return query_filter;
}
function page_number() {
}
}
});
+
+ openils.Util.getNodeByName('mattype_label', row).innerHTML =
+ mattypes.filter(function(m) {
+ return m.code() == heading.mattype() })[0].value();
});
}