</button>
</div>
</div> <!-- end search form -->
- <div id='acq-invoice-search-results-div'>
+ <div id='acq-unified-results-lineitem'>
<button dojoType='dijit.form.Button'>Add Selected Items</button><br/>
+ <style>
+ #acq-invoice-search-results-tbody { width: 100%; }
+ #acq-invoice-search-results-tbody td {
+ padding: 5px;
+ border-bottom: 1px solid #888;
+ }
+ .search-resutls-select-td {
+ padding-right: 8px; border-right: 2px solid #888;
+ }
+ .search-results-content-td {
+ padding-left: 8px; border-left: 2px solid #888;
+ }
+ </style>
+ <table>
+ <tbody id='acq-invoice-search-results-tbody'>
+ <tr id='acq-invoice-search-results-tr'>
+ <td class='search-resutls-select-td'>
+ <input type='checkbox' name='search-results-checkbox'/>
+ </td>
+ <td class='search-results-content-td'>
+ <div name='search-results-content-div'>
+ <img src='[% ctx.media_prefix %]/opac/images/progressbar_green.gif'/>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
</div>
</div>
</div>
// define custom lineitem result handler
resultManager.result_types = {
"lineitem": {
- "search_options": {
- },
- "revealer": function() {
- },
+ "search_options": { "id_list": true },
+ "revealer": function() { },
"finisher": function() {
resultsLoader.batch_length = resultManager.count_results;
},
"interface": resultsLoader
}
};
-
}
dojo.addClass(dojo.byId('oils-acq-invoice-table'), 'hidden');
dojo.removeClass(dojo.byId('oils-acq-invoice-search'), 'hidden');
}
+var resultsTbody, resultsRow;
function searchResultsLoader() {
- console.log('creating searchResultsLoader...');
-
this.displayOffset = 0;
this.displayLimit = 10;
- this.addLineitem = function(li) {
- console.log('adding lineitem ' + li);
- dojo.byId('acq-invoice-search-results-div').appendChild(
- dojo.create('div', {innerHTML : '<input type="checkbox"/> Some Book About Stuff ' + li}));
+ if (!resultsTbody) {
+ resultsTbody = dojo.byId('acq-invoice-search-results-tbody');
+ resultsRow = resultsTbody.removeChild(dojo.byId('acq-invoice-search-results-tr'));
+ }
+
+ this.addLineitem = function(li_id) {
+ console.log('Adding search result lineitem ' + li_id);
+ var row = resultsRow.cloneNode(true);
+ resultsTbody.appendChild(row);
+ openils.acq.Lineitem.fetchAndRender(
+ li_id, {},
+ function(li, html) {
+ dojo.query('[name=search-results-content-div]', row)[0].innerHTML = html;
+ }
+ );
}
}
};
this.terms = {};
- ["jub", "acqpl", "acqpo", "acqinv"].forEach(
+ ["jub", "acqpl", "acqpo", "acqinv", "acqlid"].forEach(
function(hint) {
var o = {};
o.__label = fieldmapper.IDL.fmclasses[hint].label;
this.go = function(search_object) {
- if (unifiedSearchMode == 'invoice') {
- var self = this;
- dojo.forEach([1,2,3,4,5], function(idx) {self.add('lineitem', 'foo ' + idx)});
+ if (unifiedSearchMode == 'invoice') { // TODO: s/invoice/inline/ or some such
+ uriManager = new URIManager();
+ uriManager.search_object = search_object;
+ uriManager.result_type = dojo.byId("acq-unified-result-type").getValue();
+ uriManager.conjunction = dojo.byId("acq-unified-conjunction").getValue();
+ this.search(uriManager, termManager);
+
} else {
+
location.href = oilsBasePath + "/acq/search/unified?" +
"so=" + base64Encode(search_object) +
"&rt=" + dojo.byId("acq-unified-result-type").getValue() +