6281 |
09 Jun 21 |
nicklas |
var SelectLibs = function() |
6281 |
09 Jun 21 |
nicklas |
2 |
{ |
6281 |
09 Jun 21 |
nicklas |
var select = {} |
6281 |
09 Jun 21 |
nicklas |
var debug = 0; |
6281 |
09 Jun 21 |
nicklas |
5 |
|
6281 |
09 Jun 21 |
nicklas |
select.initPage = function() |
6281 |
09 Jun 21 |
nicklas |
7 |
{ |
6281 |
09 Jun 21 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
6281 |
09 Jun 21 |
nicklas |
Buttons.addClickHandler('btnOk', select.saveSelectedLibs); |
6281 |
09 Jun 21 |
nicklas |
10 |
|
6281 |
09 Jun 21 |
nicklas |
var libs = window.opener.Demux.getAllLibraries(); |
6281 |
09 Jun 21 |
nicklas |
12 |
|
6281 |
09 Jun 21 |
nicklas |
var html = '<table id="library-list">'; |
6281 |
09 Jun 21 |
nicklas |
html += '<tr>'; |
6281 |
09 Jun 21 |
nicklas |
html += '<th></th>'; |
6281 |
09 Jun 21 |
nicklas |
html += '<th id="libheader">Library</th>'; |
6281 |
09 Jun 21 |
nicklas |
html += '<th>Barcode</th>'; |
6281 |
09 Jun 21 |
nicklas |
html += '<th>DoNotUse</th>'; |
6281 |
09 Jun 21 |
nicklas |
html += '</tr>'; |
6281 |
09 Jun 21 |
nicklas |
for (var libNo = 0; libNo < libs.length; libNo++) |
6281 |
09 Jun 21 |
nicklas |
21 |
{ |
6281 |
09 Jun 21 |
nicklas |
var lib = libs[libNo]; |
6281 |
09 Jun 21 |
nicklas |
23 |
|
6281 |
09 Jun 21 |
nicklas |
html += '<tr class="lib highlight">'; |
6281 |
09 Jun 21 |
nicklas |
html += '<td>'+(libNo+1)+'<input type="checkbox" id="c'+libNo+'" value="'+lib.id+'" '+(lib.selected?'checked':'')+'></td>'; |
6281 |
09 Jun 21 |
nicklas |
html += '<td class="lib-name"><label for="c'+libNo+'">'+Strings.encodeTags(lib.name)+'</label></td>'; |
6281 |
09 Jun 21 |
nicklas |
html += '<td>'+Strings.encodeTags(lib.barcode.name)+'</td>'; |
6281 |
09 Jun 21 |
nicklas |
html += '<td>'; |
6281 |
09 Jun 21 |
nicklas |
if (lib.DO_NOT_USE) |
6281 |
09 Jun 21 |
nicklas |
30 |
{ |
6281 |
09 Jun 21 |
nicklas |
html += Strings.encodeTags(lib.DO_NOT_USE+': '+lib.DO_NOT_USE_COMMENT); |
6281 |
09 Jun 21 |
nicklas |
32 |
} |
6281 |
09 Jun 21 |
nicklas |
html += '</td>'; |
6281 |
09 Jun 21 |
nicklas |
html += '</tr>'; |
6281 |
09 Jun 21 |
nicklas |
35 |
} |
6281 |
09 Jun 21 |
nicklas |
html += '</table>'; |
6281 |
09 Jun 21 |
nicklas |
Doc.element('libraries').innerHTML = html; |
6281 |
09 Jun 21 |
nicklas |
38 |
} |
6281 |
09 Jun 21 |
nicklas |
39 |
|
6281 |
09 Jun 21 |
nicklas |
select.saveSelectedLibs = function() |
6281 |
09 Jun 21 |
nicklas |
41 |
{ |
6281 |
09 Jun 21 |
nicklas |
var frm = document.forms['reggie']; |
6281 |
09 Jun 21 |
nicklas |
var libs = window.opener.Demux.getAllLibraries(); |
6281 |
09 Jun 21 |
nicklas |
var numSelected = 0; |
6281 |
09 Jun 21 |
nicklas |
for (var libNo = 0; libNo < libs.length; libNo++) |
6281 |
09 Jun 21 |
nicklas |
46 |
{ |
6281 |
09 Jun 21 |
nicklas |
var lib = libs[libNo]; |
6281 |
09 Jun 21 |
nicklas |
lib.selected = frm['c'+libNo].checked; |
6281 |
09 Jun 21 |
nicklas |
if (lib.selected) numSelected++; |
6281 |
09 Jun 21 |
nicklas |
50 |
} |
6281 |
09 Jun 21 |
nicklas |
51 |
|
6281 |
09 Jun 21 |
nicklas |
if (numSelected == 0) |
6281 |
09 Jun 21 |
nicklas |
53 |
{ |
6281 |
09 Jun 21 |
nicklas |
Forms.showNotification('c0', 'Please select at least one library', null, 'pointer-below'); |
6281 |
09 Jun 21 |
nicklas |
return; |
6281 |
09 Jun 21 |
nicklas |
56 |
} |
6281 |
09 Jun 21 |
nicklas |
57 |
|
6281 |
09 Jun 21 |
nicklas |
window.opener.Doc.element('libsSelectedLabel').innerHTML = '('+numSelected+' selected)'; |
6281 |
09 Jun 21 |
nicklas |
App.closeWindow(); |
6281 |
09 Jun 21 |
nicklas |
60 |
} |
6281 |
09 Jun 21 |
nicklas |
61 |
|
6281 |
09 Jun 21 |
nicklas |
return select; |
6281 |
09 Jun 21 |
nicklas |
63 |
}(); |
6281 |
09 Jun 21 |
nicklas |
64 |
|
6281 |
09 Jun 21 |
nicklas |
Doc.onLoad(SelectLibs.initPage); |