7604 |
25 Feb 19 |
nicklas |
/* $Id $ |
7604 |
25 Feb 19 |
nicklas |
2 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
Copyright (C) 2014 Nicklas Nordborg |
7604 |
25 Feb 19 |
nicklas |
4 |
|
7604 |
25 Feb 19 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
7604 |
25 Feb 19 |
nicklas |
Available at http://base.thep.lu.se/ |
7604 |
25 Feb 19 |
nicklas |
7 |
|
7604 |
25 Feb 19 |
nicklas |
BASE is free software; you can redistribute it and/or |
7604 |
25 Feb 19 |
nicklas |
modify it under the terms of the GNU General Public License |
7604 |
25 Feb 19 |
nicklas |
as published by the Free Software Foundation; either version 3 |
7604 |
25 Feb 19 |
nicklas |
of the License, or (at your option) any later version. |
7604 |
25 Feb 19 |
nicklas |
12 |
|
7604 |
25 Feb 19 |
nicklas |
BASE is distributed in the hope that it will be useful, |
7604 |
25 Feb 19 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
7604 |
25 Feb 19 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7604 |
25 Feb 19 |
nicklas |
GNU General Public License for more details. |
7604 |
25 Feb 19 |
nicklas |
17 |
|
7604 |
25 Feb 19 |
nicklas |
You should have received a copy of the GNU General Public License |
7604 |
25 Feb 19 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
7604 |
25 Feb 19 |
nicklas |
20 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
21 |
|
7604 |
25 Feb 19 |
nicklas |
@author Nicklas |
7604 |
25 Feb 19 |
nicklas |
23 |
*/ |
7604 |
25 Feb 19 |
nicklas |
'use strict'; |
7604 |
25 Feb 19 |
nicklas |
25 |
|
7604 |
25 Feb 19 |
nicklas |
var CreateChildBioPlate = function() |
7604 |
25 Feb 19 |
nicklas |
27 |
{ |
7604 |
25 Feb 19 |
nicklas |
var child = {}; |
7604 |
25 Feb 19 |
nicklas |
29 |
|
7604 |
25 Feb 19 |
nicklas |
// For drawing |
7604 |
25 Feb 19 |
nicklas |
var graphics; |
7604 |
25 Feb 19 |
nicklas |
var pen; |
7604 |
25 Feb 19 |
nicklas |
var selectedPen; |
7604 |
25 Feb 19 |
nicklas |
34 |
|
7604 |
25 Feb 19 |
nicklas |
// Source and destination plates |
7604 |
25 Feb 19 |
nicklas |
var sourcePlate; |
7604 |
25 Feb 19 |
nicklas |
var destPlates; |
7604 |
25 Feb 19 |
nicklas |
38 |
|
7604 |
25 Feb 19 |
nicklas |
// We can select one well on each plate |
7604 |
25 Feb 19 |
nicklas |
var selectedSourceWell; |
7604 |
25 Feb 19 |
nicklas |
var selectedDestWell; |
7604 |
25 Feb 19 |
nicklas |
42 |
|
7604 |
25 Feb 19 |
nicklas |
// Plate and source well currently being edited |
7604 |
25 Feb 19 |
nicklas |
var editingPlate; |
7604 |
25 Feb 19 |
nicklas |
var editingWell; |
7604 |
25 Feb 19 |
nicklas |
46 |
|
7604 |
25 Feb 19 |
nicklas |
47 |
/** |
7604 |
25 Feb 19 |
nicklas |
Initialize the page. |
7604 |
25 Feb 19 |
nicklas |
49 |
*/ |
7604 |
25 Feb 19 |
nicklas |
child.initPage = function() |
7604 |
25 Feb 19 |
nicklas |
51 |
{ |
7604 |
25 Feb 19 |
nicklas |
var pageId = Doc.getPageId(); |
7604 |
25 Feb 19 |
nicklas |
if (pageId == 'step-1') |
7604 |
25 Feb 19 |
nicklas |
54 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Save and close buttons |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnNext', child.gotoStep2); |
7604 |
25 Feb 19 |
nicklas |
58 |
|
7604 |
25 Feb 19 |
nicklas |
// Hardware |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('hardware_id.select', child.selectHardware); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('hardware_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
62 |
|
7604 |
25 Feb 19 |
nicklas |
// Protocol |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('protocol_id.select', child.selectProtocol); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('protocol_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
66 |
|
7604 |
25 Feb 19 |
nicklas |
// Protocol |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('kit_id.select', child.selectKit); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('kit_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
70 |
|
7604 |
25 Feb 19 |
nicklas |
// Tag |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('tag_id.select', child.selectTag); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('tag_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
74 |
|
7604 |
25 Feb 19 |
nicklas |
// Quantities |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('original_quantity', 'keypress', Events.numberOnly); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('used_quantity', 'keypress', Events.numberOnly); |
7604 |
25 Feb 19 |
nicklas |
78 |
|
7604 |
25 Feb 19 |
nicklas |
// Child type |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('child_biomaterial_type', 'change', child.childTypeOnChange); |
7604 |
25 Feb 19 |
nicklas |
81 |
|
7604 |
25 Feb 19 |
nicklas |
// Plate geometry |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('plategeometry_id.select', child.selectPlateGeometry); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('plategeometry_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
85 |
|
7604 |
25 Feb 19 |
nicklas |
// Bioplate type |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('bioplatetype_id.select', child.selectBioPlateType); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('bioplatetype_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
89 |
|
7604 |
25 Feb 19 |
nicklas |
// Storage location |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('freezer_id.select', child.selectFreezer); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('freezer_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
93 |
|
7604 |
25 Feb 19 |
nicklas |
// Plates |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('number_of_plates', 'keypress', Events.integerOnly); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('size', 'keypress', Events.integerOnly); |
7604 |
25 Feb 19 |
nicklas |
97 |
|
7604 |
25 Feb 19 |
nicklas |
child.childTypeOnChange(); |
7604 |
25 Feb 19 |
nicklas |
99 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (pageId == 'step-2') |
7604 |
25 Feb 19 |
nicklas |
101 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Save and close buttons |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSave', child.createChildPlate); |
7604 |
25 Feb 19 |
nicklas |
105 |
|
7604 |
25 Feb 19 |
nicklas |
// Toolbar |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnPlaceByRow', child.placeByRow); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnPlaceByColumn', child.placeByColumn); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnClearMapping', child.clearMapping); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSelectPlateMapping', child.selectPlateMapping); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('btnSelectPlateMapping', 'base-selected', child.setPlateMappingCallback); |
7604 |
25 Feb 19 |
nicklas |
112 |
|
7604 |
25 Feb 19 |
nicklas |
// Options |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('showSourceCoordinates', 'click', child.showSourceCoordinatesOnClick); |
7604 |
25 Feb 19 |
nicklas |
115 |
|
7604 |
25 Feb 19 |
nicklas |
// Handle layout changes |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(window, 'resize', child.onLayoutChange); |
7604 |
25 Feb 19 |
nicklas |
118 |
|
7604 |
25 Feb 19 |
nicklas |
// Initialize graphics |
7604 |
25 Feb 19 |
nicklas |
graphics = new jsGraphics(Doc.element('canvas')); |
7604 |
25 Feb 19 |
nicklas |
pen = new jsPen(new jsColor('#2288AA'), 1); |
7604 |
25 Feb 19 |
nicklas |
selectedPen = new jsPen(new jsColor('#2288AA'), 2); |
7604 |
25 Feb 19 |
nicklas |
123 |
|
7604 |
25 Feb 19 |
nicklas |
child.initSourceBioPlate(); |
7604 |
25 Feb 19 |
nicklas |
child.initDestinationPlates(); |
7604 |
25 Feb 19 |
nicklas |
126 |
} |
7604 |
25 Feb 19 |
nicklas |
127 |
|
7604 |
25 Feb 19 |
nicklas |
128 |
} |
7604 |
25 Feb 19 |
nicklas |
129 |
|
7604 |
25 Feb 19 |
nicklas |
child.gotoStep2 = function() |
7604 |
25 Feb 19 |
nicklas |
131 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var childType = frm.child_biomaterial_type.value; |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.event_name.value) == '') |
7604 |
25 Feb 19 |
nicklas |
135 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.event_name, 'You must enter a name for the new event'); |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
138 |
} |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.number_of_plates.value) == '') |
7604 |
25 Feb 19 |
nicklas |
140 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.number_of_plates, 'You must enter the number of plates that was created'); |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
143 |
} |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.plate_name_prefix.value) == '') |
7604 |
25 Feb 19 |
nicklas |
145 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.plate_name_prefix, 'You must enter a name prefix for the new plates'); |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
148 |
} |
7604 |
25 Feb 19 |
nicklas |
if (frm.plategeometry_id.length == 0 && childType != 'PHYSICALBIOASSAY') |
7604 |
25 Feb 19 |
nicklas |
150 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification('plategeometry_id.select', 'You must select a plate geometry'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
153 |
} |
7604 |
25 Feb 19 |
nicklas |
if (frm.bioplatetype_id.length == 0 && childType != 'PHYSICALBIOASSAY') |
7604 |
25 Feb 19 |
nicklas |
155 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification('bioplatetype_id.select', 'You must select a plate type'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
158 |
} |
7604 |
25 Feb 19 |
nicklas |
frm.submit(); |
7604 |
25 Feb 19 |
nicklas |
160 |
} |
7604 |
25 Feb 19 |
nicklas |
161 |
|
7604 |
25 Feb 19 |
nicklas |
child.selectHardware = function() |
7604 |
25 Feb 19 |
nicklas |
163 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
if (frm.hardware_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
167 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.hardware_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
170 |
} |
7604 |
25 Feb 19 |
nicklas |
var childType = frm.child_biomaterial_type.value; |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter(childType+'_subtype_id', 'HARDWARE'); |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('HARDWARE', 'hardware_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
174 |
} |
7604 |
25 Feb 19 |
nicklas |
175 |
|
7604 |
25 Feb 19 |
nicklas |
child.selectProtocol = function() |
7604 |
25 Feb 19 |
nicklas |
177 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
if (frm.protocol_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
181 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.protocol_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
184 |
} |
7604 |
25 Feb 19 |
nicklas |
var childType = frm.child_biomaterial_type[frm.child_biomaterial_type.selectedIndex].value; |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter(childType+'_subtype_id', 'PROTOCOL'); |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('PROTOCOL', 'protocol_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
188 |
} |
7604 |
25 Feb 19 |
nicklas |
189 |
|
7604 |
25 Feb 19 |
nicklas |
child.selectKit = function() |
7604 |
25 Feb 19 |
nicklas |
191 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:BOOLEAN:inactive=0'; |
7604 |
25 Feb 19 |
nicklas |
if (frm.kit_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
196 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.kit_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
199 |
} |
7604 |
25 Feb 19 |
nicklas |
var childType = frm.child_biomaterial_type[frm.child_biomaterial_type.selectedIndex].value; |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter(childType+'_subtype_id', 'KIT'); |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('KIT', 'kit_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
203 |
} |
7604 |
25 Feb 19 |
nicklas |
204 |
|
7604 |
25 Feb 19 |
nicklas |
child.selectTag = function() |
7604 |
25 Feb 19 |
nicklas |
206 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
if (frm.protocol_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
210 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.protocol_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
213 |
} |
7604 |
25 Feb 19 |
nicklas |
var childType = frm.child_biomaterial_type.value; |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter(childType+'_subtype_id', 'TAG'); |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('TAG', 'tag_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
217 |
} |
7604 |
25 Feb 19 |
nicklas |
218 |
|
7604 |
25 Feb 19 |
nicklas |
child.selectFreezer = function() |
7604 |
25 Feb 19 |
nicklas |
220 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
if (frm.freezer_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
224 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.freezer_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
227 |
} |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+Data.int('page-data', 'freezer-id'); |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('HARDWARE', 'freezer_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
230 |
} |
7604 |
25 Feb 19 |
nicklas |
231 |
|
7604 |
25 Feb 19 |
nicklas |
child.selectPlateGeometry = function() |
7604 |
25 Feb 19 |
nicklas |
233 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
if (frm.plategeometry_id.length > 0) url += '&item_id='+frm.plategeometry_id[0].value; |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('PLATEGEOMETRY', 'plategeometry_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
238 |
} |
7604 |
25 Feb 19 |
nicklas |
239 |
|
7604 |
25 Feb 19 |
nicklas |
child.selectBioPlateType = function() |
7604 |
25 Feb 19 |
nicklas |
241 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
if (frm.bioplatetype_id.length > 0) |
7604 |
25 Feb 19 |
nicklas |
245 |
{ |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+frm.bioplatetype_id[0].value; |
7604 |
25 Feb 19 |
nicklas |
247 |
} |
7604 |
25 Feb 19 |
nicklas |
248 |
|
7604 |
25 Feb 19 |
nicklas |
var childType = frm.child_biomaterial_type.value; |
7604 |
25 Feb 19 |
nicklas |
// Restrict to plates that can holds to target biomaterial |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:bioMaterialType='+encodeURIComponent('|'+Data.int('page-data', childType)); |
7604 |
25 Feb 19 |
nicklas |
var subtypeId = ItemSubtype.getSubtypeId(childType+'_subtype_id'); |
7604 |
25 Feb 19 |
nicklas |
// Restrict to plates with the given subtype |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+encodeURIComponent(subtypeId ? '|' + subtypeId : '='); |
7604 |
25 Feb 19 |
nicklas |
255 |
|
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('BIOPLATETYPE', 'bioplatetype_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
257 |
} |
7604 |
25 Feb 19 |
nicklas |
258 |
|
7604 |
25 Feb 19 |
nicklas |
child.childTypeOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
260 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var childType = frm.child_biomaterial_type.value; |
7604 |
25 Feb 19 |
nicklas |
var isSample = childType == 'SAMPLE'; |
7604 |
25 Feb 19 |
nicklas |
var isExtract = childType == 'EXTRACT'; |
7604 |
25 Feb 19 |
nicklas |
var isBioAssay = childType == 'PHYSICALBIOASSAY'; |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('sampleSubtypesDiv', isSample); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('extractSubtypesDiv', isExtract); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('bioAssaySubtypesDiv', isBioAssay); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('tagDiv', isExtract); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('originalQuantityDiv', !isBioAssay); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('freezerDiv', !isBioAssay); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('plateTypeDiv', !isBioAssay); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('geometryDiv', !isBioAssay); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('sizeDiv', isBioAssay); |
7604 |
25 Feb 19 |
nicklas |
275 |
} |
7604 |
25 Feb 19 |
nicklas |
276 |
|
7604 |
25 Feb 19 |
nicklas |
277 |
|
7604 |
25 Feb 19 |
nicklas |
278 |
/** |
7604 |
25 Feb 19 |
nicklas |
Select the source well that is clicked on. The currently selected well |
7604 |
25 Feb 19 |
nicklas |
is de-selected. If the clicked well is the same as the currently |
7604 |
25 Feb 19 |
nicklas |
selected well no new item is selected. If a destination well is already |
7604 |
25 Feb 19 |
nicklas |
selected a link is made between the source and destination wells. |
7604 |
25 Feb 19 |
nicklas |
283 |
*/ |
7604 |
25 Feb 19 |
nicklas |
child.sourceWellOnClick = function(event) |
7604 |
25 Feb 19 |
nicklas |
285 |
{ |
7604 |
25 Feb 19 |
nicklas |
var row = Data.int(event.currentTarget, 'row'); |
7604 |
25 Feb 19 |
nicklas |
var column = Data.int(event.currentTarget, 'column'); |
7604 |
25 Feb 19 |
nicklas |
288 |
|
7604 |
25 Feb 19 |
nicklas |
var well = sourcePlate.getWell(row, column); |
7604 |
25 Feb 19 |
nicklas |
if (!well) return; |
7604 |
25 Feb 19 |
nicklas |
child.storeAndHideChildInfo(); |
7604 |
25 Feb 19 |
nicklas |
292 |
|
7604 |
25 Feb 19 |
nicklas |
// De-select the currently selected source well |
7604 |
25 Feb 19 |
nicklas |
if (selectedSourceWell) |
7604 |
25 Feb 19 |
nicklas |
295 |
{ |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.setSelected(false); |
7604 |
25 Feb 19 |
nicklas |
if (well == selectedSourceWell) |
7604 |
25 Feb 19 |
nicklas |
298 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Re-draw link with regular pen (eg. same as onmouseover) |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.drawLink(graphics, pen, true); |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell = null; |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
303 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
305 |
{ |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.hideLink(graphics); |
7604 |
25 Feb 19 |
nicklas |
307 |
} |
7604 |
25 Feb 19 |
nicklas |
308 |
} |
7604 |
25 Feb 19 |
nicklas |
309 |
|
7604 |
25 Feb 19 |
nicklas |
// Select the new source well and draw link to destination well |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell = well; |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.setSelected(true); |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.drawLink(graphics, selectedPen, true); |
7604 |
25 Feb 19 |
nicklas |
314 |
|
7604 |
25 Feb 19 |
nicklas |
// Map the source and destination wells |
7604 |
25 Feb 19 |
nicklas |
if (selectedSourceWell && selectedDestWell) |
7604 |
25 Feb 19 |
nicklas |
317 |
{ |
7604 |
25 Feb 19 |
nicklas |
child.mapSelectedWells(); |
7604 |
25 Feb 19 |
nicklas |
319 |
} |
7604 |
25 Feb 19 |
nicklas |
child.showChildInfo(); |
7604 |
25 Feb 19 |
nicklas |
321 |
} |
7604 |
25 Feb 19 |
nicklas |
322 |
|
7604 |
25 Feb 19 |
nicklas |
323 |
/** |
7604 |
25 Feb 19 |
nicklas |
Draw a link between the mapped source and destination wells. |
7604 |
25 Feb 19 |
nicklas |
325 |
*/ |
7604 |
25 Feb 19 |
nicklas |
child.sourceWellOnMouseOver = function(event) |
7604 |
25 Feb 19 |
nicklas |
327 |
{ |
7604 |
25 Feb 19 |
nicklas |
var row = Data.int(event.currentTarget, 'row'); |
7604 |
25 Feb 19 |
nicklas |
var column = Data.int(event.currentTarget, 'column'); |
7604 |
25 Feb 19 |
nicklas |
330 |
|
7604 |
25 Feb 19 |
nicklas |
var well = sourcePlate.getWell(row, column); |
7604 |
25 Feb 19 |
nicklas |
if (!well) return; |
7604 |
25 Feb 19 |
nicklas |
well.drawLink(graphics, pen, false); |
7604 |
25 Feb 19 |
nicklas |
334 |
} |
7604 |
25 Feb 19 |
nicklas |
335 |
|
7604 |
25 Feb 19 |
nicklas |
336 |
/** |
7604 |
25 Feb 19 |
nicklas |
Hide the link between the mapped source and destination |
7604 |
25 Feb 19 |
nicklas |
wells, unless one of them is selected. |
7604 |
25 Feb 19 |
nicklas |
339 |
*/ |
7604 |
25 Feb 19 |
nicklas |
child.sourceWellOnMouseOut = function(event) |
7604 |
25 Feb 19 |
nicklas |
341 |
{ |
7604 |
25 Feb 19 |
nicklas |
var row = Data.int(event.currentTarget, 'row'); |
7604 |
25 Feb 19 |
nicklas |
var column = Data.int(event.currentTarget, 'column'); |
7604 |
25 Feb 19 |
nicklas |
344 |
|
7604 |
25 Feb 19 |
nicklas |
var well = sourcePlate.getWell(row, column); |
7604 |
25 Feb 19 |
nicklas |
if (!well) return; |
7604 |
25 Feb 19 |
nicklas |
if (!well.selected && !(well.mappedWell && well.mappedWell.selected)) |
7604 |
25 Feb 19 |
nicklas |
348 |
{ |
7604 |
25 Feb 19 |
nicklas |
well.hideLink(graphics); |
7604 |
25 Feb 19 |
nicklas |
350 |
} |
7604 |
25 Feb 19 |
nicklas |
351 |
} |
7604 |
25 Feb 19 |
nicklas |
352 |
|
7604 |
25 Feb 19 |
nicklas |
child.destWellOnClick = function(event) |
7604 |
25 Feb 19 |
nicklas |
354 |
{ |
7604 |
25 Feb 19 |
nicklas |
var plateNo = Data.int(event.currentTarget, 'plate'); |
7604 |
25 Feb 19 |
nicklas |
var row = Data.int(event.currentTarget, 'row'); |
7604 |
25 Feb 19 |
nicklas |
var column = Data.int(event.currentTarget, 'column'); |
7604 |
25 Feb 19 |
nicklas |
358 |
|
7604 |
25 Feb 19 |
nicklas |
var well = destPlates[plateNo].getWell(row, column); |
7604 |
25 Feb 19 |
nicklas |
child.storeAndHideChildInfo(); |
7604 |
25 Feb 19 |
nicklas |
361 |
|
7604 |
25 Feb 19 |
nicklas |
// De-select the currently selected well |
7604 |
25 Feb 19 |
nicklas |
if (selectedDestWell) |
7604 |
25 Feb 19 |
nicklas |
364 |
{ |
7604 |
25 Feb 19 |
nicklas |
selectedDestWell.setSelected(false); |
7604 |
25 Feb 19 |
nicklas |
if (well == selectedDestWell) |
7604 |
25 Feb 19 |
nicklas |
367 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Re-draw link with regular pen (eg. same as onmouseover) |
7604 |
25 Feb 19 |
nicklas |
selectedDestWell.drawLink(graphics, pen, true); |
7604 |
25 Feb 19 |
nicklas |
selectedDestWell = null; |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
372 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
374 |
{ |
7604 |
25 Feb 19 |
nicklas |
selectedDestWell.hideLink(graphics); |
7604 |
25 Feb 19 |
nicklas |
376 |
} |
7604 |
25 Feb 19 |
nicklas |
377 |
} |
7604 |
25 Feb 19 |
nicklas |
378 |
|
7604 |
25 Feb 19 |
nicklas |
selectedDestWell = well; |
7604 |
25 Feb 19 |
nicklas |
selectedDestWell.setSelected(true); |
7604 |
25 Feb 19 |
nicklas |
selectedDestWell.drawLink(graphics, selectedPen, true); |
7604 |
25 Feb 19 |
nicklas |
382 |
|
7604 |
25 Feb 19 |
nicklas |
if (selectedSourceWell && selectedDestWell) |
7604 |
25 Feb 19 |
nicklas |
384 |
{ |
7604 |
25 Feb 19 |
nicklas |
child.mapSelectedWells(); |
7604 |
25 Feb 19 |
nicklas |
386 |
} |
7604 |
25 Feb 19 |
nicklas |
child.showChildInfo(); |
7604 |
25 Feb 19 |
nicklas |
388 |
} |
7604 |
25 Feb 19 |
nicklas |
389 |
|
7604 |
25 Feb 19 |
nicklas |
child.destWellOnMouseOver = function(event) |
7604 |
25 Feb 19 |
nicklas |
391 |
{ |
7604 |
25 Feb 19 |
nicklas |
var plateNo = Data.int(event.currentTarget, 'plate'); |
7604 |
25 Feb 19 |
nicklas |
var row = Data.int(event.currentTarget, 'row'); |
7604 |
25 Feb 19 |
nicklas |
var column = Data.int(event.currentTarget, 'column'); |
7604 |
25 Feb 19 |
nicklas |
395 |
|
7604 |
25 Feb 19 |
nicklas |
var well = destPlates[plateNo].getWell(row, column); |
7604 |
25 Feb 19 |
nicklas |
if (!well) return; |
7604 |
25 Feb 19 |
nicklas |
well.drawLink(graphics, pen, false); |
7604 |
25 Feb 19 |
nicklas |
399 |
} |
7604 |
25 Feb 19 |
nicklas |
400 |
|
7604 |
25 Feb 19 |
nicklas |
child.destWellOnMouseOut = function(event) |
7604 |
25 Feb 19 |
nicklas |
402 |
{ |
7604 |
25 Feb 19 |
nicklas |
var plateNo = Data.int(event.currentTarget, 'plate'); |
7604 |
25 Feb 19 |
nicklas |
var row = Data.int(event.currentTarget, 'row'); |
7604 |
25 Feb 19 |
nicklas |
var column = Data.int(event.currentTarget, 'column'); |
7604 |
25 Feb 19 |
nicklas |
406 |
|
7604 |
25 Feb 19 |
nicklas |
var well = destPlates[plateNo].getWell(row, column); |
7604 |
25 Feb 19 |
nicklas |
if (!well) return; |
7604 |
25 Feb 19 |
nicklas |
if (!well.selected && !(well.mappedWell && well.mappedWell.selected)) |
7604 |
25 Feb 19 |
nicklas |
410 |
{ |
7604 |
25 Feb 19 |
nicklas |
well.hideLink(graphics); |
7604 |
25 Feb 19 |
nicklas |
412 |
} |
7604 |
25 Feb 19 |
nicklas |
413 |
} |
7604 |
25 Feb 19 |
nicklas |
414 |
|
7604 |
25 Feb 19 |
nicklas |
415 |
/** |
7604 |
25 Feb 19 |
nicklas |
Map the selected source and destination wells. Hide and |
7604 |
25 Feb 19 |
nicklas |
redraw links as needed. |
7604 |
25 Feb 19 |
nicklas |
418 |
*/ |
7604 |
25 Feb 19 |
nicklas |
child.mapSelectedWells = function() |
7604 |
25 Feb 19 |
nicklas |
420 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Hide any links that are currently displayed |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.hideLink(graphics); |
7604 |
25 Feb 19 |
nicklas |
selectedDestWell.hideLink(graphics); |
7604 |
25 Feb 19 |
nicklas |
424 |
|
7604 |
25 Feb 19 |
nicklas |
// Map to the new well and draw link |
7604 |
25 Feb 19 |
nicklas |
if (selectedSourceWell.mappedWell != selectedDestWell) |
7604 |
25 Feb 19 |
nicklas |
427 |
{ |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.mapToWell(selectedDestWell); |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.drawLink(graphics, pen, true); |
7604 |
25 Feb 19 |
nicklas |
430 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
432 |
{ |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.unmapWell(); |
7604 |
25 Feb 19 |
nicklas |
434 |
} |
7604 |
25 Feb 19 |
nicklas |
435 |
|
7604 |
25 Feb 19 |
nicklas |
// De-select everything |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.setSelected(false); |
7604 |
25 Feb 19 |
nicklas |
selectedDestWell.setSelected(false); |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell = null; |
7604 |
25 Feb 19 |
nicklas |
selectedDestWell = null; |
7604 |
25 Feb 19 |
nicklas |
441 |
} |
7604 |
25 Feb 19 |
nicklas |
442 |
|
7604 |
25 Feb 19 |
nicklas |
443 |
/** |
7604 |
25 Feb 19 |
nicklas |
Remove all mappings that have been made so far. |
7604 |
25 Feb 19 |
nicklas |
445 |
*/ |
7604 |
25 Feb 19 |
nicklas |
child.clearMapping = function() |
7604 |
25 Feb 19 |
nicklas |
447 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (!destPlates) |
7604 |
25 Feb 19 |
nicklas |
449 |
{ |
7604 |
25 Feb 19 |
nicklas |
alert('No destination plates have been created'); |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
452 |
} |
7604 |
25 Feb 19 |
nicklas |
if (!confirm('This will remove all placed biomaterial. Continue?')) return; |
7604 |
25 Feb 19 |
nicklas |
sourcePlate.unmapAll(graphics); |
7604 |
25 Feb 19 |
nicklas |
455 |
} |
7604 |
25 Feb 19 |
nicklas |
456 |
|
7604 |
25 Feb 19 |
nicklas |
457 |
/** |
7604 |
25 Feb 19 |
nicklas |
Automatically move remaining biomaterial to the destination plate filling rows first. |
7604 |
25 Feb 19 |
nicklas |
Biomaterial and wells that have already been mapped are skipped. |
7604 |
25 Feb 19 |
nicklas |
460 |
*/ |
7604 |
25 Feb 19 |
nicklas |
child.placeByRow = function() |
7604 |
25 Feb 19 |
nicklas |
462 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (!destPlates) |
7604 |
25 Feb 19 |
nicklas |
464 |
{ |
7604 |
25 Feb 19 |
nicklas |
alert('No destination plates have been created'); |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
467 |
} |
7604 |
25 Feb 19 |
nicklas |
var srcRow = 0; |
7604 |
25 Feb 19 |
nicklas |
var srcCol = 0; |
7604 |
25 Feb 19 |
nicklas |
for (var plateNo = 0; plateNo < destPlates.length; plateNo++) |
7604 |
25 Feb 19 |
nicklas |
471 |
{ |
7604 |
25 Feb 19 |
nicklas |
var destPlate = destPlates[plateNo]; |
7604 |
25 Feb 19 |
nicklas |
for (var destRow = 0; destRow < destPlate.rows; destRow++) |
7604 |
25 Feb 19 |
nicklas |
474 |
{ |
7604 |
25 Feb 19 |
nicklas |
for (var destCol = 0; destCol < destPlate.columns; destCol++) |
7604 |
25 Feb 19 |
nicklas |
476 |
{ |
7604 |
25 Feb 19 |
nicklas |
var destWell = destPlate.getWell(destRow, destCol); |
7604 |
25 Feb 19 |
nicklas |
if (!destWell.mappedWell && !destWell.locked) |
7604 |
25 Feb 19 |
nicklas |
479 |
{ |
7604 |
25 Feb 19 |
nicklas |
var mapped = false; |
7604 |
25 Feb 19 |
nicklas |
var srcWell = sourcePlate.getWell(srcRow, srcCol); |
7604 |
25 Feb 19 |
nicklas |
while (srcWell && !mapped) |
7604 |
25 Feb 19 |
nicklas |
483 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (srcWell.id && !srcWell.locked && !srcWell.mappedWell) |
7604 |
25 Feb 19 |
nicklas |
485 |
{ |
7604 |
25 Feb 19 |
nicklas |
srcWell.mapToWell(destWell); |
7604 |
25 Feb 19 |
nicklas |
mapped = true; |
7604 |
25 Feb 19 |
nicklas |
488 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
490 |
{ |
7604 |
25 Feb 19 |
nicklas |
srcCol++; |
7604 |
25 Feb 19 |
nicklas |
if (srcCol >= sourcePlate.columns) |
7604 |
25 Feb 19 |
nicklas |
493 |
{ |
7604 |
25 Feb 19 |
nicklas |
srcCol = 0; |
7604 |
25 Feb 19 |
nicklas |
srcRow++; |
7604 |
25 Feb 19 |
nicklas |
496 |
} |
7604 |
25 Feb 19 |
nicklas |
srcWell = sourcePlate.getWell(srcRow, srcCol); |
7604 |
25 Feb 19 |
nicklas |
498 |
} |
7604 |
25 Feb 19 |
nicklas |
499 |
} |
7604 |
25 Feb 19 |
nicklas |
500 |
} |
7604 |
25 Feb 19 |
nicklas |
501 |
} |
7604 |
25 Feb 19 |
nicklas |
502 |
} |
7604 |
25 Feb 19 |
nicklas |
503 |
} |
7604 |
25 Feb 19 |
nicklas |
504 |
} |
7604 |
25 Feb 19 |
nicklas |
505 |
|
7604 |
25 Feb 19 |
nicklas |
506 |
/** |
7604 |
25 Feb 19 |
nicklas |
Automatically move remaining biomaterial to the destination plate filling columns first. |
7604 |
25 Feb 19 |
nicklas |
Biomaterial and wells that have already been mapped are skipped. |
7604 |
25 Feb 19 |
nicklas |
509 |
*/ |
7604 |
25 Feb 19 |
nicklas |
child.placeByColumn = function() |
7604 |
25 Feb 19 |
nicklas |
511 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (!destPlates) |
7604 |
25 Feb 19 |
nicklas |
513 |
{ |
7604 |
25 Feb 19 |
nicklas |
alert('No destination plates have been created'); |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
516 |
} |
7604 |
25 Feb 19 |
nicklas |
var srcRow = 0; |
7604 |
25 Feb 19 |
nicklas |
var srcCol = 0; |
7604 |
25 Feb 19 |
nicklas |
for (var plateNo = 0; plateNo < destPlates.length; plateNo++) |
7604 |
25 Feb 19 |
nicklas |
520 |
{ |
7604 |
25 Feb 19 |
nicklas |
var destPlate = destPlates[plateNo]; |
7604 |
25 Feb 19 |
nicklas |
for (var destCol = 0; destCol < destPlate.columns; destCol++) |
7604 |
25 Feb 19 |
nicklas |
523 |
{ |
7604 |
25 Feb 19 |
nicklas |
for (var destRow = 0; destRow < destPlate.rows; destRow++) |
7604 |
25 Feb 19 |
nicklas |
525 |
{ |
7604 |
25 Feb 19 |
nicklas |
var destWell = destPlate.getWell(destRow, destCol); |
7604 |
25 Feb 19 |
nicklas |
if (!destWell.mappedWell && !destWell.locked) |
7604 |
25 Feb 19 |
nicklas |
528 |
{ |
7604 |
25 Feb 19 |
nicklas |
var mapped = false; |
7604 |
25 Feb 19 |
nicklas |
var srcWell = sourcePlate.getWell(srcRow, srcCol); |
7604 |
25 Feb 19 |
nicklas |
while (srcWell && !mapped) |
7604 |
25 Feb 19 |
nicklas |
532 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (srcWell.id && !srcWell.locked && !srcWell.mappedWell) |
7604 |
25 Feb 19 |
nicklas |
534 |
{ |
7604 |
25 Feb 19 |
nicklas |
srcWell.mapToWell(destWell); |
7604 |
25 Feb 19 |
nicklas |
mapped = true; |
7604 |
25 Feb 19 |
nicklas |
537 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
539 |
{ |
7604 |
25 Feb 19 |
nicklas |
srcRow++; |
7604 |
25 Feb 19 |
nicklas |
if (srcRow >= sourcePlate.rows) |
7604 |
25 Feb 19 |
nicklas |
542 |
{ |
7604 |
25 Feb 19 |
nicklas |
srcCol++; |
7604 |
25 Feb 19 |
nicklas |
srcRow = 0; |
7604 |
25 Feb 19 |
nicklas |
545 |
} |
7604 |
25 Feb 19 |
nicklas |
srcWell = sourcePlate.getWell(srcRow, srcCol); |
7604 |
25 Feb 19 |
nicklas |
547 |
} |
7604 |
25 Feb 19 |
nicklas |
548 |
} |
7604 |
25 Feb 19 |
nicklas |
549 |
} |
7604 |
25 Feb 19 |
nicklas |
550 |
} |
7604 |
25 Feb 19 |
nicklas |
551 |
} |
7604 |
25 Feb 19 |
nicklas |
552 |
} |
7604 |
25 Feb 19 |
nicklas |
553 |
} |
7604 |
25 Feb 19 |
nicklas |
554 |
|
7604 |
25 Feb 19 |
nicklas |
child.selectPlateMapping = function() |
7604 |
25 Feb 19 |
nicklas |
556 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (!destPlates) |
7604 |
25 Feb 19 |
nicklas |
558 |
{ |
7604 |
25 Feb 19 |
nicklas |
alert('No destination plates have been created'); |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
561 |
} |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:sourceGeometry.rows='+sourcePlate.rows; |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:sourceGeometry.columns='+sourcePlate.columns; |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:sourceCount=1'; |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:destinationGeometry.rows='+destPlates[0].rows; |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:destinationGeometry.columns='+destPlates[0].columns; |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:destinationCount=' + destPlates.length; |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('PLATEMAPPING', 'btnSelectPlateMapping', 0, url); |
7604 |
25 Feb 19 |
nicklas |
570 |
} |
7604 |
25 Feb 19 |
nicklas |
571 |
|
7604 |
25 Feb 19 |
nicklas |
child.setPlateMappingCallback = function(event) |
7604 |
25 Feb 19 |
nicklas |
573 |
{ |
7604 |
25 Feb 19 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
7604 |
25 Feb 19 |
nicklas |
var url = '../../lims/platemappings/ajax.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=GetMappingDetails&item_id=' + event.detail.id; |
7604 |
25 Feb 19 |
nicklas |
request.open("GET", url, false); |
7604 |
25 Feb 19 |
nicklas |
request.send(null); |
7604 |
25 Feb 19 |
nicklas |
var mappingInfo = JSON.parse(request.responseText); |
7604 |
25 Feb 19 |
nicklas |
if (mappingInfo.status != 'ok') |
7604 |
25 Feb 19 |
nicklas |
581 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification('btnSelectPlateMapping', plateInfo.message); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
584 |
} |
7604 |
25 Feb 19 |
nicklas |
585 |
|
7604 |
25 Feb 19 |
nicklas |
var win = Dialogs.getDialog('SelectPLATEMAPPING') || window; |
7604 |
25 Feb 19 |
nicklas |
if (mappingInfo.sourcePlates != 1 || mappingInfo.sourceRows != sourcePlate.rows || mappingInfo.sourceColumns != sourcePlate.columns) |
7604 |
25 Feb 19 |
nicklas |
588 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (!win.confirm("The selected mapping doesn't match the geometry of the source plate.\nContinue mapping overlapping positions?")) return; |
7604 |
25 Feb 19 |
nicklas |
590 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (mappingInfo.destinationPlates != destPlates.length || mappingInfo.destinationRows != destPlates[0].rows || mappingInfo.destinationColumns != destPlates[0].columns) |
7604 |
25 Feb 19 |
nicklas |
592 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (!win.confirm("The selected mapping doesn't match the geometry of the destination plate.\nContinue mapping overlapping positions?")) return; |
7604 |
25 Feb 19 |
nicklas |
594 |
} |
7604 |
25 Feb 19 |
nicklas |
595 |
|
7604 |
25 Feb 19 |
nicklas |
var numMapped = 0; |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < mappingInfo.details.length; i++) |
7604 |
25 Feb 19 |
nicklas |
598 |
{ |
7604 |
25 Feb 19 |
nicklas |
var mapping = mappingInfo.details[i].split(','); |
7604 |
25 Feb 19 |
nicklas |
var srcWell = sourcePlate.getWell(parseInt(mapping[1]), parseInt(mapping[2])); |
7604 |
25 Feb 19 |
nicklas |
var plateNo = parseInt(mapping[3]); |
7604 |
25 Feb 19 |
nicklas |
if (plateNo >= 0 && plateNo < destPlates.length) |
7604 |
25 Feb 19 |
nicklas |
603 |
{ |
7604 |
25 Feb 19 |
nicklas |
var destPlate = destPlates[plateNo]; |
7604 |
25 Feb 19 |
nicklas |
var destWell = destPlate.getWell(parseInt(mapping[4]), parseInt(mapping[5])); |
7604 |
25 Feb 19 |
nicklas |
if (srcWell && destWell) |
7604 |
25 Feb 19 |
nicklas |
607 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (!destWell.mappedWell && !destWell.locked && srcWell.id && !srcWell.locked && !srcWell.mappedWell) |
7604 |
25 Feb 19 |
nicklas |
609 |
{ |
7604 |
25 Feb 19 |
nicklas |
srcWell.mapToWell(destWell); |
7604 |
25 Feb 19 |
nicklas |
numMapped++; |
7604 |
25 Feb 19 |
nicklas |
612 |
} |
7604 |
25 Feb 19 |
nicklas |
613 |
} |
7604 |
25 Feb 19 |
nicklas |
614 |
} |
7604 |
25 Feb 19 |
nicklas |
615 |
} |
7604 |
25 Feb 19 |
nicklas |
616 |
} |
7604 |
25 Feb 19 |
nicklas |
617 |
|
7604 |
25 Feb 19 |
nicklas |
child.initSourceBioPlate = function() |
7604 |
25 Feb 19 |
nicklas |
619 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var childBioMaterialType = frm.child_biomaterial_type.value; |
7604 |
25 Feb 19 |
nicklas |
var sourceBioMaterialType = frm.source_biomaterial_type.value; |
7604 |
25 Feb 19 |
nicklas |
var isBioAssayEvent = childBioMaterialType == 'PHYSICALBIOASSAY'; |
7604 |
25 Feb 19 |
nicklas |
var childNameSuffix = ''; |
7604 |
25 Feb 19 |
nicklas |
if (childBioMaterialType == 'SAMPLE') |
7604 |
25 Feb 19 |
nicklas |
626 |
{ |
7604 |
25 Feb 19 |
nicklas |
childNameSuffix = 's'; |
7604 |
25 Feb 19 |
nicklas |
628 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (childBioMaterialType == 'EXTRACT') |
7604 |
25 Feb 19 |
nicklas |
630 |
{ |
7604 |
25 Feb 19 |
nicklas |
childNameSuffix = 'e'; |
7604 |
25 Feb 19 |
nicklas |
632 |
} |
7604 |
25 Feb 19 |
nicklas |
633 |
|
7604 |
25 Feb 19 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
7604 |
25 Feb 19 |
nicklas |
var url = '../bioplates/ajax.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=GetFullPlateInfo&item_id=' + frm.sourceplate_id.value; |
7604 |
25 Feb 19 |
nicklas |
if (!isBioAssayEvent) |
7604 |
25 Feb 19 |
nicklas |
638 |
{ |
7604 |
25 Feb 19 |
nicklas |
url += '&countChildren='+(sourceBioMaterialType == childBioMaterialType ? 'pooled' : '1'); |
7604 |
25 Feb 19 |
nicklas |
640 |
} |
7604 |
25 Feb 19 |
nicklas |
request.open("GET", url, false); |
7604 |
25 Feb 19 |
nicklas |
// NOTE! 'false' causes code to wait for the response. aka. 'Synchronous AJAX' or SJAX. |
7604 |
25 Feb 19 |
nicklas |
request.send(null); |
7604 |
25 Feb 19 |
nicklas |
var plateInfo = JSON.parse(request.responseText); |
7604 |
25 Feb 19 |
nicklas |
if (plateInfo.status != 'ok') |
7604 |
25 Feb 19 |
nicklas |
646 |
{ |
7604 |
25 Feb 19 |
nicklas |
alert(plateInfo.message); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
649 |
} |
7604 |
25 Feb 19 |
nicklas |
650 |
|
7604 |
25 Feb 19 |
nicklas |
// Get plate and well information from the AJAX response |
7604 |
25 Feb 19 |
nicklas |
var rows = plateInfo.rows; |
7604 |
25 Feb 19 |
nicklas |
var columns = plateInfo.columns; |
7604 |
25 Feb 19 |
nicklas |
654 |
|
7604 |
25 Feb 19 |
nicklas |
var bigPlate = rows > 12 || columns > 18; |
7604 |
25 Feb 19 |
nicklas |
var plateClass = bigPlate ? 'plate bigplate' : 'plate'; |
7604 |
25 Feb 19 |
nicklas |
657 |
|
7604 |
25 Feb 19 |
nicklas |
// Create plate and wells |
7604 |
25 Feb 19 |
nicklas |
var prefix = 'source'; |
7604 |
25 Feb 19 |
nicklas |
var plate = new Plate(prefix, plateInfo.id, plateInfo.name, rows, columns, true); |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < plateInfo.wells.length; i++) |
7604 |
25 Feb 19 |
nicklas |
662 |
{ |
7604 |
25 Feb 19 |
nicklas |
var wellInfo = plateInfo.wells[i]; |
7604 |
25 Feb 19 |
nicklas |
var bmInfo = wellInfo.bioMaterial; |
7604 |
25 Feb 19 |
nicklas |
var row = wellInfo.row; |
7604 |
25 Feb 19 |
nicklas |
var col = wellInfo.column; |
7604 |
25 Feb 19 |
nicklas |
var well = plate.getWell(row, col); |
7604 |
25 Feb 19 |
nicklas |
if (bmInfo) |
7604 |
25 Feb 19 |
nicklas |
669 |
{ |
7604 |
25 Feb 19 |
nicklas |
well.id = bmInfo.id; |
7604 |
25 Feb 19 |
nicklas |
well.name = bmInfo.name; |
7604 |
25 Feb 19 |
nicklas |
if (!isBioAssayEvent) |
7604 |
25 Feb 19 |
nicklas |
673 |
{ |
7604 |
25 Feb 19 |
nicklas |
well.childCount = bmInfo.childCount; |
7604 |
25 Feb 19 |
nicklas |
well.childName = well.name + '.' + childNameSuffix + (well.childCount + 1); |
7604 |
25 Feb 19 |
nicklas |
676 |
} |
7604 |
25 Feb 19 |
nicklas |
677 |
} |
7604 |
25 Feb 19 |
nicklas |
678 |
} |
7604 |
25 Feb 19 |
nicklas |
679 |
|
7604 |
25 Feb 19 |
nicklas |
// Create html table representing the bioplate |
7604 |
25 Feb 19 |
nicklas |
var html = '<table class="'+plateClass+'">'; |
7604 |
25 Feb 19 |
nicklas |
html += '<tr><td></td>'; |
7604 |
25 Feb 19 |
nicklas |
for (var c = 0; c < plate.columns; c++) |
7604 |
25 Feb 19 |
nicklas |
684 |
{ |
7604 |
25 Feb 19 |
nicklas |
html += '<td class="columnheader">' + (c+1) + '</td>'; |
7604 |
25 Feb 19 |
nicklas |
686 |
} |
7604 |
25 Feb 19 |
nicklas |
html += '</tr>'; |
7604 |
25 Feb 19 |
nicklas |
for (var r = 0; r < plate.rows; r++) |
7604 |
25 Feb 19 |
nicklas |
689 |
{ |
7604 |
25 Feb 19 |
nicklas |
html += '<tr><td class="rowheader">' + Plates.toAlphaCoordinate[r] + '</td>'; |
7604 |
25 Feb 19 |
nicklas |
for (var c = 0; c < plate.columns; c++) |
7604 |
25 Feb 19 |
nicklas |
692 |
{ |
7604 |
25 Feb 19 |
nicklas |
var well = plate.getWell(r, c); |
7604 |
25 Feb 19 |
nicklas |
var cls = 'well'; |
7604 |
25 Feb 19 |
nicklas |
var onclick = ''; |
7604 |
25 Feb 19 |
nicklas |
var onmouseover = ''; |
7604 |
25 Feb 19 |
nicklas |
var onmouseout = ''; |
7604 |
25 Feb 19 |
nicklas |
var title = well.name ? Strings.encodeTags(well.name) : ''; |
7604 |
25 Feb 19 |
nicklas |
699 |
|
7604 |
25 Feb 19 |
nicklas |
// We can only create a child biomaterial if the well is not empty |
7604 |
25 Feb 19 |
nicklas |
cls += well.id ? ' used editable' : ' empty'; |
7604 |
25 Feb 19 |
nicklas |
html += '<td id="'+prefix+'.'+r+'.'+c+'" class="' + cls + '" data-row="'+r+'" data-column="'+c+'" title="'+title+'">'; |
7604 |
25 Feb 19 |
nicklas |
html += '<div class="info" id="'+prefix+'.'+r+'.'+c+'.info"></div></td>'; |
7604 |
25 Feb 19 |
nicklas |
704 |
} |
7604 |
25 Feb 19 |
nicklas |
html += '</tr>'; |
7604 |
25 Feb 19 |
nicklas |
706 |
} |
7604 |
25 Feb 19 |
nicklas |
html += '</table>'; |
7604 |
25 Feb 19 |
nicklas |
Doc.element('plate.src').innerHTML = html; |
7604 |
25 Feb 19 |
nicklas |
Doc.element('plate.src.name').innerHTML = Strings.encodeTags(plateInfo.name); |
7604 |
25 Feb 19 |
nicklas |
sourcePlate = plate; |
7604 |
25 Feb 19 |
nicklas |
711 |
|
7604 |
25 Feb 19 |
nicklas |
var wells = Doc.element('plate.src').getElementsByClassName('editable'); |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < wells.length; i++) |
7604 |
25 Feb 19 |
nicklas |
714 |
{ |
7604 |
25 Feb 19 |
nicklas |
var well = wells[i]; |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(well, 'click', child.sourceWellOnClick); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(well, 'mouseout', child.sourceWellOnMouseOut); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(well, 'mouseover', child.sourceWellOnMouseOver); |
7604 |
25 Feb 19 |
nicklas |
719 |
} |
7604 |
25 Feb 19 |
nicklas |
720 |
} |
7604 |
25 Feb 19 |
nicklas |
721 |
|
7604 |
25 Feb 19 |
nicklas |
722 |
|
7604 |
25 Feb 19 |
nicklas |
child.initDestinationPlates = function() |
7604 |
25 Feb 19 |
nicklas |
724 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var numPlates = parseInt(frm.number_of_plates.value); |
7604 |
25 Feb 19 |
nicklas |
var childBioMaterialType = frm.child_biomaterial_type.value; |
7604 |
25 Feb 19 |
nicklas |
var rows = parseInt(frm.rows.value); |
7604 |
25 Feb 19 |
nicklas |
var columns = parseInt(frm.columns.value); |
7604 |
25 Feb 19 |
nicklas |
var namePrefix = frm.childplate_prefix.value; |
7604 |
25 Feb 19 |
nicklas |
731 |
|
7604 |
25 Feb 19 |
nicklas |
var bigPlate = rows > 12 || columns > 18; |
7604 |
25 Feb 19 |
nicklas |
var plateClass = bigPlate ? 'plate bigplate' : 'plate'; |
7604 |
25 Feb 19 |
nicklas |
734 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.element('plate.dest.info').innerHTML = numPlates + ' - ' + rows + '×' + columns; |
7604 |
25 Feb 19 |
nicklas |
736 |
|
7604 |
25 Feb 19 |
nicklas |
// Create plate and wells |
7604 |
25 Feb 19 |
nicklas |
destPlates = new Array(); |
7604 |
25 Feb 19 |
nicklas |
var html = ''; |
7604 |
25 Feb 19 |
nicklas |
for (var plateNo = 0; plateNo < numPlates; plateNo++) |
7604 |
25 Feb 19 |
nicklas |
741 |
{ |
7604 |
25 Feb 19 |
nicklas |
var prefix = 'dest.' + plateNo; |
7604 |
25 Feb 19 |
nicklas |
var plate = new Plate(prefix, plateNo, namePrefix + plateNo, rows, columns, false); |
7604 |
25 Feb 19 |
nicklas |
plate.barcode = ''; |
7604 |
25 Feb 19 |
nicklas |
destPlates[plateNo] = plate; |
7604 |
25 Feb 19 |
nicklas |
746 |
|
7604 |
25 Feb 19 |
nicklas |
// Create html table representing the bioplate |
7604 |
25 Feb 19 |
nicklas |
html += '<table class="'+plateClass+'" style="margin-bottom: 4px;">'; |
7604 |
25 Feb 19 |
nicklas |
if (plateNo == 0) |
7604 |
25 Feb 19 |
nicklas |
750 |
{ |
7604 |
25 Feb 19 |
nicklas |
html += '<tr><td></td>'; |
7604 |
25 Feb 19 |
nicklas |
for (var c = 0; c < plate.columns; c++) |
7604 |
25 Feb 19 |
nicklas |
753 |
{ |
7604 |
25 Feb 19 |
nicklas |
html += '<td class="columnheader">' + (c+1) + '</td>'; |
7604 |
25 Feb 19 |
nicklas |
755 |
} |
7604 |
25 Feb 19 |
nicklas |
html += '</tr>'; |
7604 |
25 Feb 19 |
nicklas |
757 |
} |
7604 |
25 Feb 19 |
nicklas |
for (var r = 0; r < plate.rows; r++) |
7604 |
25 Feb 19 |
nicklas |
759 |
{ |
7604 |
25 Feb 19 |
nicklas |
html += '<tr><td class="rowheader">' + Plates.toAlphaCoordinate[r] + '</td>'; |
7604 |
25 Feb 19 |
nicklas |
for (var c = 0; c < plate.columns; c++) |
7604 |
25 Feb 19 |
nicklas |
762 |
{ |
7604 |
25 Feb 19 |
nicklas |
var cls = 'well empty editable'; |
7604 |
25 Feb 19 |
nicklas |
html += '<td id="'+prefix+'.'+r+'.'+c+'" class="' + cls + '" data-plate="'+plateNo+'" data-row="'+r+'" data-column="'+c+'">'; |
7604 |
25 Feb 19 |
nicklas |
html += '<div class="info" id="'+prefix+'.'+r+'.'+c+'.info"></div></td>'; |
7604 |
25 Feb 19 |
nicklas |
766 |
} |
7604 |
25 Feb 19 |
nicklas |
html += '</tr>'; |
7604 |
25 Feb 19 |
nicklas |
768 |
} |
7604 |
25 Feb 19 |
nicklas |
html += '</table>'; |
7604 |
25 Feb 19 |
nicklas |
770 |
} |
7604 |
25 Feb 19 |
nicklas |
771 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.element('plate.dest').innerHTML = html; |
7604 |
25 Feb 19 |
nicklas |
773 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.hide('destplatecreateoptions'); |
7604 |
25 Feb 19 |
nicklas |
Doc.show('toolbar.mappings'); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('plate.dest.options', !bigPlate); |
7604 |
25 Feb 19 |
nicklas |
777 |
|
7604 |
25 Feb 19 |
nicklas |
var wells = Doc.element('plate.dest').getElementsByClassName('editable'); |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < wells.length; i++) |
7604 |
25 Feb 19 |
nicklas |
780 |
{ |
7604 |
25 Feb 19 |
nicklas |
var well = wells[i]; |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(well, 'click', child.destWellOnClick); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(well, 'mouseout', child.destWellOnMouseOut); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(well, 'mouseover', child.destWellOnMouseOver); |
7604 |
25 Feb 19 |
nicklas |
785 |
} |
7604 |
25 Feb 19 |
nicklas |
786 |
|
7604 |
25 Feb 19 |
nicklas |
child.showSourceCoordinatesOnClick(); |
7604 |
25 Feb 19 |
nicklas |
788 |
} |
7604 |
25 Feb 19 |
nicklas |
789 |
|
7604 |
25 Feb 19 |
nicklas |
790 |
/** |
7604 |
25 Feb 19 |
nicklas |
Redraw the link between selected wells when the layout changes |
7604 |
25 Feb 19 |
nicklas |
792 |
*/ |
7604 |
25 Feb 19 |
nicklas |
child.onLayoutChange = function(event) |
7604 |
25 Feb 19 |
nicklas |
794 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (selectedSourceWell) |
7604 |
25 Feb 19 |
nicklas |
796 |
{ |
7604 |
25 Feb 19 |
nicklas |
selectedSourceWell.drawLink(graphics, selectedPen, true); |
7604 |
25 Feb 19 |
nicklas |
798 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (selectedDestWell) |
7604 |
25 Feb 19 |
nicklas |
800 |
{ |
7604 |
25 Feb 19 |
nicklas |
selectedDestWell.drawLink(graphics, selectedPen, true); |
7604 |
25 Feb 19 |
nicklas |
802 |
} |
7604 |
25 Feb 19 |
nicklas |
803 |
} |
7604 |
25 Feb 19 |
nicklas |
804 |
|
7604 |
25 Feb 19 |
nicklas |
child.showSourceCoordinatesOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
806 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
Doc.addOrRemoveClass('plate.dest', 'noinfo', !frm.showSourceCoordinates.checked); |
7604 |
25 Feb 19 |
nicklas |
809 |
} |
7604 |
25 Feb 19 |
nicklas |
810 |
|
7604 |
25 Feb 19 |
nicklas |
811 |
|
7604 |
25 Feb 19 |
nicklas |
child.showChildInfo = function() |
7604 |
25 Feb 19 |
nicklas |
813 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (selectedDestWell) |
7604 |
25 Feb 19 |
nicklas |
815 |
{ |
7604 |
25 Feb 19 |
nicklas |
editingPlate = selectedDestWell.plate; |
7604 |
25 Feb 19 |
nicklas |
editingWell = selectedDestWell.mappedWell; |
7604 |
25 Feb 19 |
nicklas |
818 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (selectedSourceWell) |
7604 |
25 Feb 19 |
nicklas |
820 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (selectedSourceWell.mappedWell) |
7604 |
25 Feb 19 |
nicklas |
822 |
{ |
7604 |
25 Feb 19 |
nicklas |
editingPlate = selectedSourceWell.mappedWell.plate; |
7604 |
25 Feb 19 |
nicklas |
824 |
} |
7604 |
25 Feb 19 |
nicklas |
editingWell = selectedSourceWell; |
7604 |
25 Feb 19 |
nicklas |
826 |
} |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var isBioAssayEvent = frm.child_biomaterial_type.value == 'PHYSICALBIOASSAY'; |
7604 |
25 Feb 19 |
nicklas |
if (editingPlate) |
7604 |
25 Feb 19 |
nicklas |
830 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.plate_name.value = editingPlate.name; |
7604 |
25 Feb 19 |
nicklas |
if (!isBioAssayEvent) |
7604 |
25 Feb 19 |
nicklas |
833 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.plate_barcode.value = editingPlate.barcode; |
7604 |
25 Feb 19 |
nicklas |
835 |
} |
7604 |
25 Feb 19 |
nicklas |
Doc.show('childplate.info', 'table'); |
7604 |
25 Feb 19 |
nicklas |
837 |
} |
7604 |
25 Feb 19 |
nicklas |
if (editingWell && !isBioAssayEvent) |
7604 |
25 Feb 19 |
nicklas |
839 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.biomaterial_name.value = editingWell.childName; |
7604 |
25 Feb 19 |
nicklas |
Doc.show('childbiomaterial.info', 'table'); |
7604 |
25 Feb 19 |
nicklas |
842 |
} |
7604 |
25 Feb 19 |
nicklas |
843 |
} |
7604 |
25 Feb 19 |
nicklas |
844 |
|
7604 |
25 Feb 19 |
nicklas |
child.storeAndHideChildInfo = function() |
7604 |
25 Feb 19 |
nicklas |
846 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var isBioAssayEvent = frm.child_biomaterial_type.value == 'PHYSICALBIOASSAY'; |
7604 |
25 Feb 19 |
nicklas |
if (editingWell && !isBioAssayEvent) |
7604 |
25 Feb 19 |
nicklas |
850 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.hide('childbiomaterial.info'); |
7604 |
25 Feb 19 |
nicklas |
editingWell.childName = frm.biomaterial_name.value; |
7604 |
25 Feb 19 |
nicklas |
editingWell = null; |
7604 |
25 Feb 19 |
nicklas |
854 |
} |
7604 |
25 Feb 19 |
nicklas |
if (editingPlate) |
7604 |
25 Feb 19 |
nicklas |
856 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.hide('childplate.info'); |
7604 |
25 Feb 19 |
nicklas |
editingPlate.name = frm.plate_name.value; |
7604 |
25 Feb 19 |
nicklas |
if (!isBioAssayEvent) |
7604 |
25 Feb 19 |
nicklas |
860 |
{ |
7604 |
25 Feb 19 |
nicklas |
editingPlate.barcode = frm.plate_barcode.value; |
7604 |
25 Feb 19 |
nicklas |
862 |
} |
7604 |
25 Feb 19 |
nicklas |
editingPlate = null; |
7604 |
25 Feb 19 |
nicklas |
864 |
} |
7604 |
25 Feb 19 |
nicklas |
865 |
|
7604 |
25 Feb 19 |
nicklas |
866 |
} |
7604 |
25 Feb 19 |
nicklas |
867 |
|
7604 |
25 Feb 19 |
nicklas |
child.createChildPlate = function() |
7604 |
25 Feb 19 |
nicklas |
869 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['main']; |
7604 |
25 Feb 19 |
nicklas |
var numMapped = 0; |
7604 |
25 Feb 19 |
nicklas |
var isBioAssayEvent = frm.child_biomaterial_type.value == 'PHYSICALBIOASSAY'; |
7604 |
25 Feb 19 |
nicklas |
for (var plateNo = 0; plateNo < destPlates.length; plateNo++) |
7604 |
25 Feb 19 |
nicklas |
874 |
{ |
7604 |
25 Feb 19 |
nicklas |
var destPlate = destPlates[plateNo]; |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, 'plate.' + plateNo + '.name', destPlate.name); |
7604 |
25 Feb 19 |
nicklas |
if (!isBioAssayEvent) |
7604 |
25 Feb 19 |
nicklas |
878 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, 'plate.' + plateNo + '.barcode', destPlate.barcode); |
7604 |
25 Feb 19 |
nicklas |
880 |
} |
7604 |
25 Feb 19 |
nicklas |
for (var row = 0; row < destPlate.rows; row++) |
7604 |
25 Feb 19 |
nicklas |
882 |
{ |
7604 |
25 Feb 19 |
nicklas |
for (var column = 0; column < destPlate.columns; column++) |
7604 |
25 Feb 19 |
nicklas |
884 |
{ |
7604 |
25 Feb 19 |
nicklas |
var well = destPlate.getWell(row, column); |
7604 |
25 Feb 19 |
nicklas |
if (well.mappedWell) |
7604 |
25 Feb 19 |
nicklas |
887 |
{ |
7604 |
25 Feb 19 |
nicklas |
var prefix = 'well.' +plateNo + '.' + row + '.' + column; |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, prefix, well.mappedWell.id); |
7604 |
25 Feb 19 |
nicklas |
if (!isBioAssayEvent) |
7604 |
25 Feb 19 |
nicklas |
891 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, prefix + '.name', well.mappedWell.childName); |
7604 |
25 Feb 19 |
nicklas |
893 |
} |
7604 |
25 Feb 19 |
nicklas |
numMapped++; |
7604 |
25 Feb 19 |
nicklas |
895 |
} |
7604 |
25 Feb 19 |
nicklas |
896 |
} |
7604 |
25 Feb 19 |
nicklas |
897 |
} |
7604 |
25 Feb 19 |
nicklas |
898 |
} |
7604 |
25 Feb 19 |
nicklas |
899 |
|
7604 |
25 Feb 19 |
nicklas |
if (numMapped == 0) |
7604 |
25 Feb 19 |
nicklas |
901 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification('btnSave', 'No wells have been mapped.'); |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
904 |
} |
7604 |
25 Feb 19 |
nicklas |
905 |
|
7604 |
25 Feb 19 |
nicklas |
frm.submit(); |
7604 |
25 Feb 19 |
nicklas |
907 |
} |
7604 |
25 Feb 19 |
nicklas |
908 |
|
7604 |
25 Feb 19 |
nicklas |
909 |
|
7604 |
25 Feb 19 |
nicklas |
return child; |
7604 |
25 Feb 19 |
nicklas |
911 |
}(); |
7604 |
25 Feb 19 |
nicklas |
912 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.onLoad(CreateChildBioPlate.initPage); |