5924 |
29 Apr 20 |
nicklas |
var Ssp = function() |
5924 |
29 Apr 20 |
nicklas |
2 |
{ |
5924 |
29 Apr 20 |
nicklas |
var ssp = {}; |
5924 |
29 Apr 20 |
nicklas |
var debug = 0; |
5924 |
29 Apr 20 |
nicklas |
var manuallySelected = []; |
5924 |
29 Apr 20 |
nicklas |
var selectionIsValid = false; |
5924 |
29 Apr 20 |
nicklas |
var rawDataType; |
5924 |
29 Apr 20 |
nicklas |
var pipeline; |
5924 |
29 Apr 20 |
nicklas |
var annotationTypePipeline; |
5924 |
29 Apr 20 |
nicklas |
var models; |
5924 |
29 Apr 20 |
nicklas |
var numModelsSelected = 0; |
5924 |
29 Apr 20 |
nicklas |
12 |
|
5924 |
29 Apr 20 |
nicklas |
// Page initialization |
5924 |
29 Apr 20 |
nicklas |
ssp.initPage = function() |
5924 |
29 Apr 20 |
nicklas |
15 |
{ |
5924 |
29 Apr 20 |
nicklas |
// Step 1 |
5924 |
29 Apr 20 |
nicklas |
Buttons.addClickHandler('btnSelectRawBioAssays', ssp.selectRawBioAssays); |
5924 |
29 Apr 20 |
nicklas |
Events.addEventHandler('rawBioAssays', 'base-selected', ssp.setRawBioAssayCallback); |
5924 |
29 Apr 20 |
nicklas |
Events.addEventHandler('rawBioAssays', 'change', ssp.rawBioAssaysOnChange); |
5924 |
29 Apr 20 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', ssp.validateStep1); |
5962 |
03 Jun 20 |
nicklas |
Events.addEventHandler('which_all', 'change', ssp.whichOnChange); |
5962 |
03 Jun 20 |
nicklas |
Events.addEventHandler('which_selected', 'change', ssp.whichOnChange); |
5962 |
03 Jun 20 |
nicklas |
23 |
|
5924 |
29 Apr 20 |
nicklas |
// Step 2 |
5924 |
29 Apr 20 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', ssp.initializeStep2); |
5944 |
20 May 20 |
nicklas |
Events.addEventHandler('presets', 'change', ssp.presetOnChange); |
5924 |
29 Apr 20 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', ssp.validateStep2); |
5924 |
29 Apr 20 |
nicklas |
28 |
|
5924 |
29 Apr 20 |
nicklas |
// Navigation |
5924 |
29 Apr 20 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
5924 |
29 Apr 20 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
5924 |
29 Apr 20 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
5924 |
29 Apr 20 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
5924 |
29 Apr 20 |
nicklas |
34 |
|
5924 |
29 Apr 20 |
nicklas |
// Final registration |
5924 |
29 Apr 20 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', ssp.submit); |
5924 |
29 Apr 20 |
nicklas |
37 |
|
5924 |
29 Apr 20 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
5924 |
29 Apr 20 |
nicklas |
var url = '../Ssp.servlet?ID='+App.getSessionId(); |
5924 |
29 Apr 20 |
nicklas |
url += '&cmd=GetRawBioAssaysForSsp'; |
5924 |
29 Apr 20 |
nicklas |
Wizard.asyncJsonRequest(url, ssp.initializeStep1); |
5924 |
29 Apr 20 |
nicklas |
42 |
} |
5924 |
29 Apr 20 |
nicklas |
43 |
|
5924 |
29 Apr 20 |
nicklas |
// --- Step 1 ----------------------------------- |
5924 |
29 Apr 20 |
nicklas |
ssp.initializeStep1 = function(response) |
5924 |
29 Apr 20 |
nicklas |
46 |
{ |
5924 |
29 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5924 |
29 Apr 20 |
nicklas |
48 |
|
5924 |
29 Apr 20 |
nicklas |
rawDataType = response.rawDataType; |
5924 |
29 Apr 20 |
nicklas |
pipeline = response.pipeline; |
5924 |
29 Apr 20 |
nicklas |
51 |
|
5924 |
29 Apr 20 |
nicklas |
var rawBioAssays = response.rawBioAssays; |
5924 |
29 Apr 20 |
nicklas |
if (rawBioAssays.length > 0) |
5924 |
29 Apr 20 |
nicklas |
54 |
{ |
5924 |
29 Apr 20 |
nicklas |
var firstPlate = null; |
5924 |
29 Apr 20 |
nicklas |
for (var rawNo=0; rawNo < rawBioAssays.length; rawNo++) |
5924 |
29 Apr 20 |
nicklas |
57 |
{ |
5924 |
29 Apr 20 |
nicklas |
var raw = rawBioAssays[rawNo]; |
5924 |
29 Apr 20 |
nicklas |
59 |
|
5924 |
29 Apr 20 |
nicklas |
var libPlate = raw.lib.bioWell ? raw.lib.bioWell.bioPlate : null; |
5924 |
29 Apr 20 |
nicklas |
if (firstPlate == null && libPlate != null) firstPlate = libPlate.name; |
5924 |
29 Apr 20 |
nicklas |
var option = ssp.createListOption(rawNo+1, raw, raw.DO_NOT_USE == null && libPlate != null && libPlate.name==firstPlate) |
5924 |
29 Apr 20 |
nicklas |
frm.rawBioAssays.options[frm.rawBioAssays.length] = option; |
5924 |
29 Apr 20 |
nicklas |
64 |
} |
5924 |
29 Apr 20 |
nicklas |
Events.sendChangeEvent('rawBioAssays'); |
5924 |
29 Apr 20 |
nicklas |
66 |
} |
5924 |
29 Apr 20 |
nicklas |
else |
5924 |
29 Apr 20 |
nicklas |
68 |
{ |
5924 |
29 Apr 20 |
nicklas |
Wizard.setInputStatus('rawBioAssays', 'invalid', 'No raw bioassays available for processing'); |
5924 |
29 Apr 20 |
nicklas |
70 |
} |
5924 |
29 Apr 20 |
nicklas |
71 |
|
5924 |
29 Apr 20 |
nicklas |
Doc.show('step-1'); |
5924 |
29 Apr 20 |
nicklas |
Doc.show('gonext'); |
5924 |
29 Apr 20 |
nicklas |
74 |
} |
5924 |
29 Apr 20 |
nicklas |
75 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.validateStep1 = function(event) |
5924 |
29 Apr 20 |
nicklas |
77 |
{ |
5924 |
29 Apr 20 |
nicklas |
if (!selectionIsValid) event.preventDefault(); |
5924 |
29 Apr 20 |
nicklas |
79 |
} |
5924 |
29 Apr 20 |
nicklas |
80 |
|
5962 |
03 Jun 20 |
nicklas |
ssp.whichOnChange = function() |
5962 |
03 Jun 20 |
nicklas |
82 |
{ |
5962 |
03 Jun 20 |
nicklas |
var frm = document.forms['reggie']; |
5962 |
03 Jun 20 |
nicklas |
if (Doc.element('which_all').checked) |
5962 |
03 Jun 20 |
nicklas |
85 |
{ |
5962 |
03 Jun 20 |
nicklas |
selectionIsValid = true; |
5962 |
03 Jun 20 |
nicklas |
Wizard.setInputStatus('rawBioAssays'); |
5962 |
03 Jun 20 |
nicklas |
frm.rawBioAssays.disabled = true; |
5962 |
03 Jun 20 |
nicklas |
Doc.addClass('btnSelectRawBioAssays', 'disabled'); |
5962 |
03 Jun 20 |
nicklas |
90 |
} |
5962 |
03 Jun 20 |
nicklas |
else |
5962 |
03 Jun 20 |
nicklas |
92 |
{ |
5962 |
03 Jun 20 |
nicklas |
frm.rawBioAssays.disabled = false; |
5962 |
03 Jun 20 |
nicklas |
Doc.removeClass('btnSelectRawBioAssays', 'disabled'); |
5962 |
03 Jun 20 |
nicklas |
Events.sendChangeEvent('rawBioAssays'); |
5962 |
03 Jun 20 |
nicklas |
96 |
} |
5962 |
03 Jun 20 |
nicklas |
97 |
} |
5962 |
03 Jun 20 |
nicklas |
98 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.selectRawBioAssays = function() |
5924 |
29 Apr 20 |
nicklas |
100 |
{ |
5924 |
29 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5924 |
29 Apr 20 |
nicklas |
if (frm.rawBioAssays.disabled) return; |
5924 |
29 Apr 20 |
nicklas |
// Reset list |
5924 |
29 Apr 20 |
nicklas |
manuallySelected = []; |
5924 |
29 Apr 20 |
nicklas |
var url = '&resetTemporary=1'; |
5924 |
29 Apr 20 |
nicklas |
if (rawDataType) url += '&tmpfilter:STRING:rawDataType='+encodeURIComponent(rawDataType); |
5924 |
29 Apr 20 |
nicklas |
if (pipeline != null) |
5924 |
29 Apr 20 |
nicklas |
108 |
{ |
5924 |
29 Apr 20 |
nicklas |
if (annotationTypePipeline == null) |
5924 |
29 Apr 20 |
nicklas |
110 |
{ |
5924 |
29 Apr 20 |
nicklas |
annotationTypePipeline = Reggie.getAnnotationTypeInfo('PIPELINE'); |
5924 |
29 Apr 20 |
nicklas |
112 |
} |
5924 |
29 Apr 20 |
nicklas |
url += '&tmpfilter:STRING:'+encodeURIComponent('#')+annotationTypePipeline.id+'='+encodeURIComponent(pipeline); |
5924 |
29 Apr 20 |
nicklas |
114 |
} |
5924 |
29 Apr 20 |
nicklas |
Dialogs.selectItem('RAWBIOASSAY', 'rawBioAssays', 1, url); |
5924 |
29 Apr 20 |
nicklas |
116 |
} |
5924 |
29 Apr 20 |
nicklas |
117 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.setRawBioAssayCallback = function(event) |
5924 |
29 Apr 20 |
nicklas |
119 |
{ |
5924 |
29 Apr 20 |
nicklas |
var raw = event.detail; |
5924 |
29 Apr 20 |
nicklas |
121 |
|
5924 |
29 Apr 20 |
nicklas |
var opt = Reggie.getListOption('rawBioAssays', raw.id); |
5924 |
29 Apr 20 |
nicklas |
if (opt) |
5924 |
29 Apr 20 |
nicklas |
124 |
{ |
5924 |
29 Apr 20 |
nicklas |
opt.selected = true; |
5924 |
29 Apr 20 |
nicklas |
126 |
} |
5924 |
29 Apr 20 |
nicklas |
else |
5924 |
29 Apr 20 |
nicklas |
128 |
{ |
5924 |
29 Apr 20 |
nicklas |
manuallySelected[manuallySelected.length] = raw.id; |
5924 |
29 Apr 20 |
nicklas |
130 |
} |
5924 |
29 Apr 20 |
nicklas |
131 |
|
5924 |
29 Apr 20 |
nicklas |
if (raw.remaining == 0 && manuallySelected.length > 0) |
5924 |
29 Apr 20 |
nicklas |
133 |
{ |
5924 |
29 Apr 20 |
nicklas |
var url = '../Ssp.servlet?ID='+App.getSessionId(); |
5924 |
29 Apr 20 |
nicklas |
url += '&cmd=GetRawBioAssaysForSsp'; |
5924 |
29 Apr 20 |
nicklas |
url += '&items='+manuallySelected.join(','); |
5924 |
29 Apr 20 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
5924 |
29 Apr 20 |
nicklas |
Wizard.asyncJsonRequest(url, ssp.manuallySelected); |
5924 |
29 Apr 20 |
nicklas |
139 |
} |
5924 |
29 Apr 20 |
nicklas |
else |
5924 |
29 Apr 20 |
nicklas |
141 |
{ |
5924 |
29 Apr 20 |
nicklas |
Events.sendChangeEvent('rawBioAssays'); |
5924 |
29 Apr 20 |
nicklas |
143 |
} |
5924 |
29 Apr 20 |
nicklas |
144 |
} |
5924 |
29 Apr 20 |
nicklas |
145 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.manuallySelected = function(response) |
5924 |
29 Apr 20 |
nicklas |
147 |
{ |
5924 |
29 Apr 20 |
nicklas |
var rawBioAssays = response.rawBioAssays; |
5924 |
29 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5924 |
29 Apr 20 |
nicklas |
150 |
|
5924 |
29 Apr 20 |
nicklas |
if (rawBioAssays != null && rawBioAssays.length > 0) |
5924 |
29 Apr 20 |
nicklas |
152 |
{ |
5924 |
29 Apr 20 |
nicklas |
var offset = frm.rawBioAssays.length+1; |
5924 |
29 Apr 20 |
nicklas |
for (var rawNo=0; rawNo < rawBioAssays.length; rawNo++) |
5924 |
29 Apr 20 |
nicklas |
155 |
{ |
5924 |
29 Apr 20 |
nicklas |
var raw = rawBioAssays[rawNo]; |
5924 |
29 Apr 20 |
nicklas |
var option = ssp.createListOption(rawNo+offset, raw, raw.DO_NOT_USE == null); |
5924 |
29 Apr 20 |
nicklas |
frm.rawBioAssays.options[frm.rawBioAssays.length] = option; |
5924 |
29 Apr 20 |
nicklas |
159 |
} |
5924 |
29 Apr 20 |
nicklas |
Events.sendChangeEvent('rawBioAssays'); |
5924 |
29 Apr 20 |
nicklas |
161 |
} |
5924 |
29 Apr 20 |
nicklas |
162 |
} |
5924 |
29 Apr 20 |
nicklas |
163 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.createListOption = function(index, rawItem, selected) |
5924 |
29 Apr 20 |
nicklas |
165 |
{ |
5924 |
29 Apr 20 |
nicklas |
var lib = rawItem.lib; |
5924 |
29 Apr 20 |
nicklas |
var isYellow = lib.specimen && lib.specimen.YellowLabel != null; |
5924 |
29 Apr 20 |
nicklas |
var libPlate = lib.bioWell ? lib.bioWell.bioPlate : null; |
5924 |
29 Apr 20 |
nicklas |
169 |
|
5924 |
29 Apr 20 |
nicklas |
var tooltip = null; |
5924 |
29 Apr 20 |
nicklas |
var name = (index) + ': '; |
5924 |
29 Apr 20 |
nicklas |
if (libPlate) name += libPlate.name + ' - '; |
5924 |
29 Apr 20 |
nicklas |
name += rawItem.name; |
5924 |
29 Apr 20 |
nicklas |
174 |
|
5924 |
29 Apr 20 |
nicklas |
if (rawItem.DO_NOT_USE) |
5924 |
29 Apr 20 |
nicklas |
176 |
{ |
5924 |
29 Apr 20 |
nicklas |
name += ' [DoNotUse]'; |
5924 |
29 Apr 20 |
nicklas |
tooltip = 'DoNotUse-'+Strings.encodeTags(rawItem.DO_NOT_USE+': '+rawItem.DO_NOT_USE_COMMENT); |
5924 |
29 Apr 20 |
nicklas |
179 |
} |
5924 |
29 Apr 20 |
nicklas |
else if (rawItem.AutoProcess == 'ReProcess') |
5924 |
29 Apr 20 |
nicklas |
181 |
{ |
5924 |
29 Apr 20 |
nicklas |
name += ' [R]'; |
5924 |
29 Apr 20 |
nicklas |
183 |
} |
5924 |
29 Apr 20 |
nicklas |
184 |
|
5924 |
29 Apr 20 |
nicklas |
var option = new Option(name, rawItem.id, false, selected); |
5924 |
29 Apr 20 |
nicklas |
if (isYellow) option.className = 'yellow'; |
5924 |
29 Apr 20 |
nicklas |
if (tooltip) option.title = tooltip; |
5924 |
29 Apr 20 |
nicklas |
option.rawBioAssay = rawItem; |
5924 |
29 Apr 20 |
nicklas |
return option; |
5924 |
29 Apr 20 |
nicklas |
190 |
} |
5924 |
29 Apr 20 |
nicklas |
191 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.rawBioAssaysOnChange = function() |
5924 |
29 Apr 20 |
nicklas |
193 |
{ |
5924 |
29 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5924 |
29 Apr 20 |
nicklas |
195 |
|
5924 |
29 Apr 20 |
nicklas |
selectionIsValid = false; |
5924 |
29 Apr 20 |
nicklas |
var numSelected = 0; |
5924 |
29 Apr 20 |
nicklas |
var numDoNotUse = 0; |
5924 |
29 Apr 20 |
nicklas |
var invalidPipeline = null; |
5924 |
29 Apr 20 |
nicklas |
200 |
|
5924 |
29 Apr 20 |
nicklas |
Wizard.setInputStatus('rawBioAssays'); |
5924 |
29 Apr 20 |
nicklas |
Wizard.hideGoNextConfirmation(); |
5924 |
29 Apr 20 |
nicklas |
203 |
|
5924 |
29 Apr 20 |
nicklas |
for (var rawNo = 0; rawNo < frm.rawBioAssays.length; rawNo++) |
5924 |
29 Apr 20 |
nicklas |
205 |
{ |
5924 |
29 Apr 20 |
nicklas |
if (frm.rawBioAssays[rawNo].selected) |
5924 |
29 Apr 20 |
nicklas |
207 |
{ |
5924 |
29 Apr 20 |
nicklas |
numSelected++; |
5924 |
29 Apr 20 |
nicklas |
209 |
|
5924 |
29 Apr 20 |
nicklas |
var raw = frm.rawBioAssays[rawNo].rawBioAssay; |
5924 |
29 Apr 20 |
nicklas |
if (raw.DO_NOT_USE) numDoNotUse++; |
5924 |
29 Apr 20 |
nicklas |
212 |
|
5924 |
29 Apr 20 |
nicklas |
if (pipeline && raw.pipeline && raw.pipeline != pipeline) |
5924 |
29 Apr 20 |
nicklas |
214 |
{ |
5924 |
29 Apr 20 |
nicklas |
invalidPipeline = Strings.encodeTags(raw.name+' ('+raw.pipeline)+') is not intended for the '+pipeline+' pipeline.'; |
5924 |
29 Apr 20 |
nicklas |
216 |
} |
5924 |
29 Apr 20 |
nicklas |
217 |
} |
5924 |
29 Apr 20 |
nicklas |
218 |
} |
5924 |
29 Apr 20 |
nicklas |
if (numSelected == 0) |
5924 |
29 Apr 20 |
nicklas |
220 |
{ |
5924 |
29 Apr 20 |
nicklas |
Wizard.setInputStatus('rawBioAssays', 'invalid', 'Select at least one item'); |
5924 |
29 Apr 20 |
nicklas |
return; |
5924 |
29 Apr 20 |
nicklas |
223 |
} |
5924 |
29 Apr 20 |
nicklas |
if (invalidPipeline) |
5924 |
29 Apr 20 |
nicklas |
225 |
{ |
5924 |
29 Apr 20 |
nicklas |
Wizard.setInputStatus('rawBioAssays', 'invalid', invalidPipeline); |
5924 |
29 Apr 20 |
nicklas |
return; |
5924 |
29 Apr 20 |
nicklas |
228 |
} |
5924 |
29 Apr 20 |
nicklas |
selectionIsValid = true; |
5924 |
29 Apr 20 |
nicklas |
230 |
|
5924 |
29 Apr 20 |
nicklas |
if (numDoNotUse > 0) |
5924 |
29 Apr 20 |
nicklas |
232 |
{ |
5924 |
29 Apr 20 |
nicklas |
Wizard.setInputStatus('rawBioAssays', 'warning', numDoNotUse + ' selected items marked as DoNotUse'); |
5924 |
29 Apr 20 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Confirm ' + numDoNotUse + ' items marked as DoNotUse'); |
5924 |
29 Apr 20 |
nicklas |
235 |
} |
5924 |
29 Apr 20 |
nicklas |
else |
5924 |
29 Apr 20 |
nicklas |
237 |
{ |
5924 |
29 Apr 20 |
nicklas |
Wizard.setInputStatus('rawBioAssays', 'valid'); |
5924 |
29 Apr 20 |
nicklas |
239 |
} |
5924 |
29 Apr 20 |
nicklas |
240 |
} |
5924 |
29 Apr 20 |
nicklas |
241 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.initializeStep2 = function() |
5924 |
29 Apr 20 |
nicklas |
243 |
{ |
5924 |
29 Apr 20 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
5924 |
29 Apr 20 |
nicklas |
var url = '../Ssp.servlet?ID='+App.getSessionId(); |
5924 |
29 Apr 20 |
nicklas |
url += '&cmd=GetModels'; |
5924 |
29 Apr 20 |
nicklas |
Wizard.asyncJsonRequest(url, ssp.modelsLoaded); |
5924 |
29 Apr 20 |
nicklas |
248 |
} |
5924 |
29 Apr 20 |
nicklas |
249 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.modelsLoaded = function(response) |
5924 |
29 Apr 20 |
nicklas |
251 |
{ |
5944 |
20 May 20 |
nicklas |
var frm = document.forms['reggie']; |
5944 |
20 May 20 |
nicklas |
253 |
|
5924 |
29 Apr 20 |
nicklas |
models = response.models; |
5924 |
29 Apr 20 |
nicklas |
if (models.length == 0) |
5924 |
29 Apr 20 |
nicklas |
256 |
{ |
5924 |
29 Apr 20 |
nicklas |
Wizard.setFatalError('No SSP models have been configured in reggie-config.xml.'); |
5924 |
29 Apr 20 |
nicklas |
258 |
} |
5924 |
29 Apr 20 |
nicklas |
259 |
|
5944 |
20 May 20 |
nicklas |
var presets = response.presets; |
5944 |
20 May 20 |
nicklas |
for (var pNo = 0; pNo < presets.length; pNo++) |
5944 |
20 May 20 |
nicklas |
262 |
{ |
5944 |
20 May 20 |
nicklas |
var preset = presets[pNo]; |
5944 |
20 May 20 |
nicklas |
var option = new Option(preset.name); |
5944 |
20 May 20 |
nicklas |
option.preset = preset; |
5944 |
20 May 20 |
nicklas |
frm.presets[frm.presets.length] = option; |
5944 |
20 May 20 |
nicklas |
267 |
} |
5944 |
20 May 20 |
nicklas |
268 |
|
5924 |
29 Apr 20 |
nicklas |
var html = ''; |
5924 |
29 Apr 20 |
nicklas |
for (var mNo = 0; mNo < models.length; mNo++) |
5924 |
29 Apr 20 |
nicklas |
271 |
{ |
5924 |
29 Apr 20 |
nicklas |
var model = models[mNo]; |
5944 |
20 May 20 |
nicklas |
html += '<tr class="align-top" id="modelrow.'+mNo+'">'; |
5941 |
18 May 20 |
nicklas |
html += '<td class="subprompt"><label for="model.'+mNo+'">'+Strings.encodeTags(model.name)+'</label></td>'; |
5941 |
18 May 20 |
nicklas |
html += '<td style="width: 2em;"><input type="checkbox" name="model.'+mNo+'" id="model.'+mNo+'"></td>'; |
5941 |
18 May 20 |
nicklas |
html += '<td class="input"><div class="modeldescription">'+(Strings.encodeTags(model.description) || ' ')+'</div></td>'; |
5941 |
18 May 20 |
nicklas |
html += '<td class="status" id="model.'+mNo+'.status"></td>'; |
5941 |
18 May 20 |
nicklas |
html += '<td class="help"><span id="model.'+mNo+'.message" class="message"></span></td>'; |
5927 |
29 Apr 20 |
nicklas |
html += '</tr>'; |
5924 |
29 Apr 20 |
nicklas |
280 |
} |
5924 |
29 Apr 20 |
nicklas |
Doc.element('models').innerHTML = html; |
5941 |
18 May 20 |
nicklas |
Forms.linkCheckboxesWithLabels(Doc.element('models')); |
5924 |
29 Apr 20 |
nicklas |
283 |
|
5941 |
18 May 20 |
nicklas |
for (var mNo = 0; mNo < models.length; mNo++) |
5924 |
29 Apr 20 |
nicklas |
285 |
{ |
5941 |
18 May 20 |
nicklas |
var model = models[mNo]; |
5941 |
18 May 20 |
nicklas |
var checkbox = Doc.element('model.'+mNo); |
5941 |
18 May 20 |
nicklas |
if (model.error) |
5941 |
18 May 20 |
nicklas |
289 |
{ |
5944 |
20 May 20 |
nicklas |
Wizard.setInputStatus('model.'+mNo, 'warning', Reggie.softLineBreaks(model.error)); |
5941 |
18 May 20 |
nicklas |
checkbox.disabled = true; |
5941 |
18 May 20 |
nicklas |
292 |
} |
5941 |
18 May 20 |
nicklas |
else |
5941 |
18 May 20 |
nicklas |
294 |
{ |
5941 |
18 May 20 |
nicklas |
checkbox.checked = true; |
5941 |
18 May 20 |
nicklas |
296 |
} |
5941 |
18 May 20 |
nicklas |
Events.addEventHandler(checkbox, 'change', ssp.onModelSelected); |
5924 |
29 Apr 20 |
nicklas |
298 |
} |
5941 |
18 May 20 |
nicklas |
ssp.onModelSelected(); |
5924 |
29 Apr 20 |
nicklas |
300 |
|
5924 |
29 Apr 20 |
nicklas |
Wizard.setCurrentStep(2); |
5924 |
29 Apr 20 |
nicklas |
Doc.show('goregister'); |
5924 |
29 Apr 20 |
nicklas |
Doc.show('gocancel'); |
5924 |
29 Apr 20 |
nicklas |
304 |
|
5924 |
29 Apr 20 |
nicklas |
305 |
} |
5924 |
29 Apr 20 |
nicklas |
306 |
|
5944 |
20 May 20 |
nicklas |
ssp.presetOnChange = function() |
5944 |
20 May 20 |
nicklas |
308 |
{ |
5944 |
20 May 20 |
nicklas |
var frm = document.forms['reggie']; |
5944 |
20 May 20 |
nicklas |
var preset = frm.presets[frm.presets.selectedIndex].preset; |
5944 |
20 May 20 |
nicklas |
311 |
|
5944 |
20 May 20 |
nicklas |
for (var mNo = 0; mNo < models.length; mNo++) |
5944 |
20 May 20 |
nicklas |
313 |
{ |
5944 |
20 May 20 |
nicklas |
var model = models[mNo]; |
5944 |
20 May 20 |
nicklas |
if (!frm['model.'+mNo].disabled) |
5944 |
20 May 20 |
nicklas |
316 |
{ |
5944 |
20 May 20 |
nicklas |
frm['model.'+mNo].checked = !preset || preset.models.indexOf(model.name) >= 0; |
5944 |
20 May 20 |
nicklas |
318 |
} |
5944 |
20 May 20 |
nicklas |
319 |
} |
5944 |
20 May 20 |
nicklas |
ssp.onModelSelected(); |
5944 |
20 May 20 |
nicklas |
321 |
} |
5944 |
20 May 20 |
nicklas |
322 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.onModelSelected = function() |
5924 |
29 Apr 20 |
nicklas |
324 |
{ |
5924 |
29 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5924 |
29 Apr 20 |
nicklas |
numModelsSelected = 0; |
5924 |
29 Apr 20 |
nicklas |
for (var mNo = 0; mNo < models.length; mNo++) |
5924 |
29 Apr 20 |
nicklas |
328 |
{ |
5924 |
29 Apr 20 |
nicklas |
if (frm['model.'+mNo].checked) numModelsSelected++; |
5944 |
20 May 20 |
nicklas |
Doc.addOrRemoveClass('modelrow.'+mNo, 'selected', frm['model.'+mNo].checked); |
5924 |
29 Apr 20 |
nicklas |
331 |
} |
5924 |
29 Apr 20 |
nicklas |
332 |
|
5924 |
29 Apr 20 |
nicklas |
if (numModelsSelected > 0) |
5924 |
29 Apr 20 |
nicklas |
334 |
{ |
5924 |
29 Apr 20 |
nicklas |
Wizard.setInputStatus('models', 'valid'); |
5927 |
29 Apr 20 |
nicklas |
Doc.removeClass('models', 'invalid'); |
5924 |
29 Apr 20 |
nicklas |
337 |
} |
5924 |
29 Apr 20 |
nicklas |
else |
5924 |
29 Apr 20 |
nicklas |
339 |
{ |
5924 |
29 Apr 20 |
nicklas |
Wizard.setInputStatus('models', 'invalid', 'Select at least one model!'); |
5927 |
29 Apr 20 |
nicklas |
Doc.addClass('models', 'invalid'); |
5924 |
29 Apr 20 |
nicklas |
342 |
} |
5924 |
29 Apr 20 |
nicklas |
343 |
} |
5924 |
29 Apr 20 |
nicklas |
344 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.validateStep2 = function(event) |
5924 |
29 Apr 20 |
nicklas |
346 |
{ |
5924 |
29 Apr 20 |
nicklas |
if (numModelsSelected == 0) event.preventDefault(); |
5924 |
29 Apr 20 |
nicklas |
348 |
} |
5924 |
29 Apr 20 |
nicklas |
349 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.submit = function() |
5924 |
29 Apr 20 |
nicklas |
351 |
{ |
5924 |
29 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5924 |
29 Apr 20 |
nicklas |
var submitInfo = {}; |
5924 |
29 Apr 20 |
nicklas |
354 |
|
5924 |
29 Apr 20 |
nicklas |
var selectedRba = []; |
5924 |
29 Apr 20 |
nicklas |
var selectedModels = []; |
5924 |
29 Apr 20 |
nicklas |
submitInfo.rawBioAssays = selectedRba; |
5924 |
29 Apr 20 |
nicklas |
submitInfo.models = selectedModels; |
6025 |
26 Oct 20 |
nicklas |
submitInfo.autoConfirm = frm.autoConfirm.checked; |
5962 |
03 Jun 20 |
nicklas |
360 |
|
5962 |
03 Jun 20 |
nicklas |
if (Doc.element('which_selected').checked) |
5924 |
29 Apr 20 |
nicklas |
362 |
{ |
5962 |
03 Jun 20 |
nicklas |
for (var rawNo = 0; rawNo < frm.rawBioAssays.length; rawNo++) |
5924 |
29 Apr 20 |
nicklas |
364 |
{ |
5962 |
03 Jun 20 |
nicklas |
if (frm.rawBioAssays[rawNo].selected) |
5962 |
03 Jun 20 |
nicklas |
366 |
{ |
5962 |
03 Jun 20 |
nicklas |
selectedRba[selectedRba.length] = frm.rawBioAssays[rawNo].rawBioAssay.id; |
5962 |
03 Jun 20 |
nicklas |
368 |
} |
5924 |
29 Apr 20 |
nicklas |
369 |
} |
5924 |
29 Apr 20 |
nicklas |
370 |
} |
5924 |
29 Apr 20 |
nicklas |
for (var mNo = 0; mNo < models.length; mNo++) |
5924 |
29 Apr 20 |
nicklas |
372 |
{ |
5924 |
29 Apr 20 |
nicklas |
if (frm['model.'+mNo].checked) |
5924 |
29 Apr 20 |
nicklas |
374 |
{ |
5924 |
29 Apr 20 |
nicklas |
selectedModels[selectedModels.length] = models[mNo].name; |
5924 |
29 Apr 20 |
nicklas |
376 |
} |
5924 |
29 Apr 20 |
nicklas |
377 |
} |
5924 |
29 Apr 20 |
nicklas |
378 |
|
5924 |
29 Apr 20 |
nicklas |
var url = '../Ssp.servlet?ID='+App.getSessionId(); |
5924 |
29 Apr 20 |
nicklas |
url += '&cmd=RunSsp'; |
5924 |
29 Apr 20 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
5924 |
29 Apr 20 |
nicklas |
Wizard.asyncJsonRequest(url, ssp.submissionResults, 'POST', JSON.stringify(submitInfo)); |
5924 |
29 Apr 20 |
nicklas |
383 |
} |
5924 |
29 Apr 20 |
nicklas |
384 |
|
5924 |
29 Apr 20 |
nicklas |
ssp.submissionResults = function(response) |
5924 |
29 Apr 20 |
nicklas |
386 |
{ |
5924 |
29 Apr 20 |
nicklas |
Wizard.showFinalMessage(response.messages); |
5924 |
29 Apr 20 |
nicklas |
Doc.show('gorestart'); |
5924 |
29 Apr 20 |
nicklas |
389 |
} |
5924 |
29 Apr 20 |
nicklas |
390 |
|
5924 |
29 Apr 20 |
nicklas |
391 |
|
5924 |
29 Apr 20 |
nicklas |
return ssp; |
5924 |
29 Apr 20 |
nicklas |
393 |
}(); |
5924 |
29 Apr 20 |
nicklas |
394 |
|
5924 |
29 Apr 20 |
nicklas |
Doc.onLoad(Ssp.initPage); |
5924 |
29 Apr 20 |
nicklas |
396 |
|