7604 |
25 Feb 19 |
nicklas |
/* $Id $ |
7604 |
25 Feb 19 |
nicklas |
2 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
Copyright (C) 2013 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 BioAssays = function() |
7604 |
25 Feb 19 |
nicklas |
27 |
{ |
7604 |
25 Feb 19 |
nicklas |
var bioassays = {}; |
7604 |
25 Feb 19 |
nicklas |
29 |
|
7604 |
25 Feb 19 |
nicklas |
30 |
/** |
7604 |
25 Feb 19 |
nicklas |
Initialize the page. |
7604 |
25 Feb 19 |
nicklas |
32 |
*/ |
7604 |
25 Feb 19 |
nicklas |
bioassays.initPage = function() |
7604 |
25 Feb 19 |
nicklas |
34 |
{ |
7604 |
25 Feb 19 |
nicklas |
var pageId = Doc.getPageId(); |
7604 |
25 Feb 19 |
nicklas |
if (pageId == 'edit-page') |
7604 |
25 Feb 19 |
nicklas |
37 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Save + Close buttons |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSave', bioassays.save); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
41 |
|
7604 |
25 Feb 19 |
nicklas |
// Tab validation |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('settings.annotations', bioassays.loadAnnotationsFrame); |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('settings.datafiles', bioassays.loadDataFilesFrame); |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabValidator('settings.info', bioassays.validateBioAssay); |
7604 |
25 Feb 19 |
nicklas |
46 |
|
7604 |
25 Feb 19 |
nicklas |
// Subtype |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('subtype_id', 'change', bioassays.subtypeOnChange); |
7604 |
25 Feb 19 |
nicklas |
49 |
|
7604 |
25 Feb 19 |
nicklas |
// Extract |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('extract_id.select', bioassays.selectExtract); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('extract_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
53 |
|
7604 |
25 Feb 19 |
nicklas |
// Protocol |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('protocol_id.select', bioassays.selectProtocol); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('protocol_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
57 |
|
7604 |
25 Feb 19 |
nicklas |
// Kit |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('kit_id.select', bioassays.selectKit); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('kit_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
61 |
|
7604 |
25 Feb 19 |
nicklas |
// Hardware |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('hardware_id.select', bioassays.selectHardware); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('hardware_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
65 |
|
7604 |
25 Feb 19 |
nicklas |
// Software |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('software_id.select', bioassays.selectSoftware); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('software_id', 'base-selected', Items.onItemSelected); |
7604 |
25 Feb 19 |
nicklas |
69 |
|
7604 |
25 Feb 19 |
nicklas |
// Parent derived bioassays |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnAddParents', bioassays.addParents); |
7604 |
25 Feb 19 |
nicklas |
72 |
|
7604 |
25 Feb 19 |
nicklas |
// Parent physical bioassays |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnAddPhysicalBioAssays', bioassays.addPhysicalBioAssays); |
7604 |
25 Feb 19 |
nicklas |
75 |
|
7604 |
25 Feb 19 |
nicklas |
// Parent type |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('isRoot', 'click', bioassays.isRootOnChange); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('isChild', 'click', bioassays.isRootOnChange); |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
if (frm.isRoot) |
7604 |
25 Feb 19 |
nicklas |
81 |
{ |
7604 |
25 Feb 19 |
nicklas |
bioassays.isRootOnChange(); |
7604 |
25 Feb 19 |
nicklas |
83 |
} |
7604 |
25 Feb 19 |
nicklas |
84 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (pageId == 'view-page') |
7604 |
25 Feb 19 |
nicklas |
86 |
{ |
7604 |
25 Feb 19 |
nicklas |
var itemId = Data.get('page-data', 'item-id'); |
7604 |
25 Feb 19 |
nicklas |
var attributes = {'item-type': 'DERIVEDBIOASSAY', 'item-id': itemId}; |
7604 |
25 Feb 19 |
nicklas |
89 |
|
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnEdit', Buttons.editItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDelete', Buttons.deleteItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRestore', Buttons.restoreItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnUsingItems', Buttons.showUsingItems, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDeletePermanently', Buttons.deleteItemPermanently, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnShare', Buttons.shareItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSetOwner', Buttons.setOwner, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnNewChildBioAssay', bioassays.newChildBioAssay, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnNewRawBioAssay', bioassays.newRawBioAssay, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnExport', Buttons.runPlugin, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRunAnalysisPlugin', Buttons.runPlugin, attributes); |
7604 |
25 Feb 19 |
nicklas |
103 |
|
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('main.annotations', AnnotationsList.loadOnce); |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('main.overview', Overview.loadOnce); |
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('main.history', History.loadOnce); |
7604 |
25 Feb 19 |
nicklas |
107 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (pageId == 'list-page') |
7604 |
25 Feb 19 |
nicklas |
109 |
{ |
7604 |
25 Feb 19 |
nicklas |
var attributes = {'item-type': 'DERIVEDBIOASSAY'}; |
7604 |
25 Feb 19 |
nicklas |
var tableAttributes = {'table-id': 'bioassays'}; |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnNewItem', Buttons.newItem, attributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDeleteItems', Buttons.deleteItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRestoreItems', Buttons.restoreItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnShareItems', Buttons.shareItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSetOwner', Buttons.setOwnerOfItems, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnColumns', Buttons.configureColumns, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnInheritAnnotations', Buttons.inheritAnnotations, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnExport', Buttons.runListPlugin, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnImport', Buttons.runListPlugin, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRunPlugin', Buttons.runListPlugin, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnNewMergedDerivedBioAssay', bioassays.newMergedDerivedBioAssay); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnNewItemList', bioassays.newItemListOnClick); |
7813 |
19 May 20 |
nicklas |
Buttons.addClickHandler('btnAddToItemList', bioassays.addToItemListOnClick); |
7604 |
25 Feb 19 |
nicklas |
125 |
|
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnOk', Buttons.returnSelected, tableAttributes); |
7604 |
25 Feb 19 |
nicklas |
128 |
} |
7604 |
25 Feb 19 |
nicklas |
129 |
} |
7604 |
25 Feb 19 |
nicklas |
130 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.initElements = function(element, autoInit) |
7604 |
25 Feb 19 |
nicklas |
132 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (autoInit == 'new-child-bioassay') |
7604 |
25 Feb 19 |
nicklas |
134 |
{ |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler(element, bioassays.newChildBioAssay); |
7604 |
25 Feb 19 |
nicklas |
136 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (autoInit == 'new-raw-bioassay') |
7604 |
25 Feb 19 |
nicklas |
138 |
{ |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler(element, bioassays.newRawBioAssay); |
7604 |
25 Feb 19 |
nicklas |
140 |
} |
7604 |
25 Feb 19 |
nicklas |
141 |
} |
7604 |
25 Feb 19 |
nicklas |
142 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.newMergedDerivedBioAssay = function() |
7604 |
25 Feb 19 |
nicklas |
144 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (!Table.checkIfSelected('bioassays')) |
7604 |
25 Feb 19 |
nicklas |
146 |
{ |
7604 |
25 Feb 19 |
nicklas |
return; |
7604 |
25 Feb 19 |
nicklas |
148 |
} |
7604 |
25 Feb 19 |
nicklas |
Table.submitToPopup('bioassays', 'NewMergedDerivedBioAssay', 750, 500); |
7604 |
25 Feb 19 |
nicklas |
150 |
} |
7604 |
25 Feb 19 |
nicklas |
151 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.newChildBioAssay = function(event) |
7604 |
25 Feb 19 |
nicklas |
153 |
{ |
7604 |
25 Feb 19 |
nicklas |
var parentId = Data.int(event.currentTarget, 'item-id'); |
7604 |
25 Feb 19 |
nicklas |
Items.newItem('DERIVEDBIOASSAY', '&parent_id='+parentId); |
7604 |
25 Feb 19 |
nicklas |
156 |
} |
7604 |
25 Feb 19 |
nicklas |
157 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.newRawBioAssay = function(event) |
7604 |
25 Feb 19 |
nicklas |
159 |
{ |
7604 |
25 Feb 19 |
nicklas |
var parentId = Data.int(event.currentTarget, 'item-id'); |
7604 |
25 Feb 19 |
nicklas |
Items.newItem('RAWBIOASSAY', '&bioassay_id='+parentId); |
7604 |
25 Feb 19 |
nicklas |
162 |
} |
7604 |
25 Feb 19 |
nicklas |
163 |
|
7604 |
25 Feb 19 |
nicklas |
// Create a new item list with the selected items as members |
7604 |
25 Feb 19 |
nicklas |
bioassays.newItemListOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
166 |
{ |
7604 |
25 Feb 19 |
nicklas |
var controller = Items.getController('ITEMLIST'); |
7604 |
25 Feb 19 |
nicklas |
Table.submitToPopup('bioassays', 'CreateItemList', controller.width, controller.height); |
7604 |
25 Feb 19 |
nicklas |
169 |
} |
7813 |
19 May 20 |
nicklas |
// Add selected bioassays to an existing item list |
7813 |
19 May 20 |
nicklas |
bioassays.addToItemListOnClick = function() |
7813 |
19 May 20 |
nicklas |
172 |
{ |
7813 |
19 May 20 |
nicklas |
Table.submitToPopup('bioassays', 'AddItemsToList', 450, 300); |
7813 |
19 May 20 |
nicklas |
174 |
} |
7604 |
25 Feb 19 |
nicklas |
175 |
|
7604 |
25 Feb 19 |
nicklas |
176 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.validateBioAssay = function() |
7604 |
25 Feb 19 |
nicklas |
178 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.name.value) == '') |
7604 |
25 Feb 19 |
nicklas |
181 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.name, 'You must enter a name'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
184 |
} |
7604 |
25 Feb 19 |
nicklas |
return true; |
7604 |
25 Feb 19 |
nicklas |
186 |
} |
7604 |
25 Feb 19 |
nicklas |
187 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.save = function() |
7604 |
25 Feb 19 |
nicklas |
189 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
if (TabControl.validateActiveTab('settings')) |
7604 |
25 Feb 19 |
nicklas |
192 |
{ |
7604 |
25 Feb 19 |
nicklas |
Annotations.saveModifiedAnnotationsToForm(frm); |
7604 |
25 Feb 19 |
nicklas |
DataFiles.writeFileActionsToForm(frm); |
7604 |
25 Feb 19 |
nicklas |
if (Doc.element('physicalBioAssays')) |
7604 |
25 Feb 19 |
nicklas |
196 |
{ |
7604 |
25 Feb 19 |
nicklas |
Link.exportActions('physicalBioAssays'); |
7604 |
25 Feb 19 |
nicklas |
198 |
} |
7604 |
25 Feb 19 |
nicklas |
if (Doc.element('parents')) |
7604 |
25 Feb 19 |
nicklas |
200 |
{ |
7604 |
25 Feb 19 |
nicklas |
Link.exportActions('parents'); |
7604 |
25 Feb 19 |
nicklas |
202 |
} |
7604 |
25 Feb 19 |
nicklas |
frm.submit(); |
7604 |
25 Feb 19 |
nicklas |
204 |
} |
7604 |
25 Feb 19 |
nicklas |
205 |
} |
7604 |
25 Feb 19 |
nicklas |
206 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.loadAnnotationsFrame = function() |
7604 |
25 Feb 19 |
nicklas |
208 |
{ |
7604 |
25 Feb 19 |
nicklas |
Annotations.autoLoadEditFrame(bioassays.getProtocolId(), ItemSubtype.getSubtypeId('subtype_id'), bioassays.getParents()); |
7604 |
25 Feb 19 |
nicklas |
210 |
} |
7604 |
25 Feb 19 |
nicklas |
211 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.loadDataFilesFrame = function() |
7604 |
25 Feb 19 |
nicklas |
213 |
{ |
7604 |
25 Feb 19 |
nicklas |
var subtypeId = ItemSubtype.getSubtypeId('subtype_id'); |
7604 |
25 Feb 19 |
nicklas |
DataFiles.autoLoadEditFrame(0, 0, subtypeId); |
7604 |
25 Feb 19 |
nicklas |
216 |
} |
7604 |
25 Feb 19 |
nicklas |
217 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.getProtocolId = function() |
7604 |
25 Feb 19 |
nicklas |
219 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
var protocolId = 0; |
7604 |
25 Feb 19 |
nicklas |
if (frm.protocol_id.length > 0 && !frm.protocol_id.disabled) |
7604 |
25 Feb 19 |
nicklas |
223 |
{ |
7604 |
25 Feb 19 |
nicklas |
protocolId = Math.abs(parseInt(frm.protocol_id.value)); |
7604 |
25 Feb 19 |
nicklas |
225 |
} |
7604 |
25 Feb 19 |
nicklas |
return protocolId; |
7604 |
25 Feb 19 |
nicklas |
227 |
} |
7604 |
25 Feb 19 |
nicklas |
228 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.getParents = function() |
7604 |
25 Feb 19 |
nicklas |
230 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
232 |
|
7604 |
25 Feb 19 |
nicklas |
var parents = []; |
7604 |
25 Feb 19 |
nicklas |
if (frm.physicalBioAssays && (!frm.isRoot || frm.isRoot[0].checked)) |
7604 |
25 Feb 19 |
nicklas |
235 |
{ |
7604 |
25 Feb 19 |
nicklas |
var ids = Link.getIdsInList(frm.physicalBioAssays, 'PHYSICALBIOASSAY'); |
7604 |
25 Feb 19 |
nicklas |
if (ids.length > 0) |
7604 |
25 Feb 19 |
nicklas |
238 |
{ |
7604 |
25 Feb 19 |
nicklas |
parents[parents.length] = 'PHYSICALBIOASSAY:'+ids.join(':'); |
7604 |
25 Feb 19 |
nicklas |
240 |
} |
7604 |
25 Feb 19 |
nicklas |
241 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (frm.parents && (!frm.isRoot || frm.isRoot[1].checked)) |
7604 |
25 Feb 19 |
nicklas |
243 |
{ |
7604 |
25 Feb 19 |
nicklas |
var ids = Link.getIdsInList(frm.parents, 'DERIVEDBIOASSAY'); |
7604 |
25 Feb 19 |
nicklas |
if (ids.length > 0) |
7604 |
25 Feb 19 |
nicklas |
246 |
{ |
7604 |
25 Feb 19 |
nicklas |
parents[parents.length] = 'DERIVEDBIOASSAY:'+ids.join(':'); |
7604 |
25 Feb 19 |
nicklas |
248 |
} |
7604 |
25 Feb 19 |
nicklas |
249 |
} |
7604 |
25 Feb 19 |
nicklas |
var extractId = Math.abs(parseInt(frm.extract_id.value)); |
7604 |
25 Feb 19 |
nicklas |
if (extractId > 0) parents[parents.length] = 'EXTRACT:'+extractId; |
7604 |
25 Feb 19 |
nicklas |
var protocolId = Math.abs(parseInt(frm.protocol_id.value)); |
7604 |
25 Feb 19 |
nicklas |
if (protocolId > 0) parents[parents.length] = 'PROTOCOL:'+protocolId; |
7604 |
25 Feb 19 |
nicklas |
var hardwareId = Math.abs(parseInt(frm.hardware_id.value)); |
7604 |
25 Feb 19 |
nicklas |
if (hardwareId > 0) parents[parents.length] = 'HARDWARE:'+hardwareId; |
7604 |
25 Feb 19 |
nicklas |
var softwareId = Math.abs(parseInt(frm.software_id.value)); |
7604 |
25 Feb 19 |
nicklas |
if (softwareId > 0) parents[parents.length] = 'SOFTWARE:'+softwareId; |
7604 |
25 Feb 19 |
nicklas |
var kitId = Math.abs(parseInt(frm.kit_id.value)); |
7604 |
25 Feb 19 |
nicklas |
if (kitId > 0) parents[parents.length] = 'KIT:'+kitId; |
7604 |
25 Feb 19 |
nicklas |
return parents; |
7604 |
25 Feb 19 |
nicklas |
261 |
} |
7604 |
25 Feb 19 |
nicklas |
262 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.subtypeOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
264 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
var subtypeId = ItemSubtype.getSubtypeId('subtype_id'); |
7604 |
25 Feb 19 |
nicklas |
var recentInfo = ItemSubtype.getRelatedProjectDefaultAndRecentItems('DERIVEDBIOASSAY', subtypeId, ['PROTOCOL', 'KIT', 'HARDWARE', 'SOFTWARE']); |
7604 |
25 Feb 19 |
nicklas |
ItemSubtype.updateSelectionList(frm.protocol_id, recentInfo.PROTOCOL['recent'], recentInfo.PROTOCOL['default']); |
7604 |
25 Feb 19 |
nicklas |
ItemSubtype.updateSelectionList(frm.kit_id, recentInfo.KIT['recent']); |
7604 |
25 Feb 19 |
nicklas |
ItemSubtype.updateSelectionList(frm.hardware_id, recentInfo.HARDWARE['recent'], recentInfo.HARDWARE['default']); |
7604 |
25 Feb 19 |
nicklas |
ItemSubtype.updateSelectionList(frm.software_id, recentInfo.SOFTWARE['recent'], recentInfo.SOFTWARE['default']); |
7604 |
25 Feb 19 |
nicklas |
272 |
} |
7604 |
25 Feb 19 |
nicklas |
273 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.selectProtocol = function() |
7604 |
25 Feb 19 |
nicklas |
275 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter('subtype_id', 'PROTOCOL'); |
7604 |
25 Feb 19 |
nicklas |
if (frm.protocol_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
280 |
{ |
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 |
283 |
} |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('PROTOCOL', 'protocol_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
285 |
} |
7604 |
25 Feb 19 |
nicklas |
286 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.selectKit = function() |
7604 |
25 Feb 19 |
nicklas |
288 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:BOOLEAN:inactive=0'; |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter('subtype_id', 'KIT'); |
7604 |
25 Feb 19 |
nicklas |
if (frm.kit_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
294 |
{ |
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 |
297 |
} |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('KIT', 'kit_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
299 |
} |
7604 |
25 Feb 19 |
nicklas |
300 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.selectHardware = function() |
7604 |
25 Feb 19 |
nicklas |
302 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter('subtype_id', 'HARDWARE'); |
7604 |
25 Feb 19 |
nicklas |
if (frm.hardware_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
307 |
{ |
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 |
310 |
} |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('HARDWARE', 'hardware_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
312 |
} |
7604 |
25 Feb 19 |
nicklas |
313 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.selectSoftware = function() |
7604 |
25 Feb 19 |
nicklas |
315 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter('subtype_id', 'SOFTWARE'); |
7604 |
25 Feb 19 |
nicklas |
if (frm.software_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
320 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.software_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
323 |
} |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('SOFTWARE', 'software_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
325 |
} |
7604 |
25 Feb 19 |
nicklas |
326 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.isRootOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
328 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
var isRoot = frm.isRoot[0].checked; |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('physicalBioAssaySection', isRoot); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('parentBioAssaySection', !isRoot); |
7604 |
25 Feb 19 |
nicklas |
333 |
} |
7604 |
25 Feb 19 |
nicklas |
334 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.addParents = function() |
7604 |
25 Feb 19 |
nicklas |
336 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
var current = Link.getIdsInList(frm.parents, 'DERIVEDBIOASSAY'); |
7604 |
25 Feb 19 |
nicklas |
var url = "&resetTemporary=1&exclude="+current.join(','); |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter('subtype_id', 'DERIVEDBIOASSAY'); |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('DERIVEDBIOASSAY', 'parents', 1, url); |
7604 |
25 Feb 19 |
nicklas |
342 |
} |
7604 |
25 Feb 19 |
nicklas |
343 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.addPhysicalBioAssays = function() |
7604 |
25 Feb 19 |
nicklas |
345 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
var current = Link.getIdsInList(frm.physicalBioAssays, 'PHYSICALBIOASSAY'); |
7604 |
25 Feb 19 |
nicklas |
var url = "&resetTemporary=1&exclude="+current.join(','); |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter('subtype_id', 'PHYSICALBIOASSAY'); |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('PHYSICALBIOASSAY', 'physicalBioAssays', 1, url); |
7604 |
25 Feb 19 |
nicklas |
351 |
} |
7604 |
25 Feb 19 |
nicklas |
352 |
|
7604 |
25 Feb 19 |
nicklas |
bioassays.selectExtract = function() |
7604 |
25 Feb 19 |
nicklas |
354 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['bioAssay']; |
7604 |
25 Feb 19 |
nicklas |
356 |
|
7604 |
25 Feb 19 |
nicklas |
var relatedExtractIds = null; |
7604 |
25 Feb 19 |
nicklas |
if (frm.physicalBioAssays && (!frm.isRoot || frm.isRoot[0].checked)) |
7604 |
25 Feb 19 |
nicklas |
359 |
{ |
7604 |
25 Feb 19 |
nicklas |
var ids = Link.getIdsInList(frm.physicalBioAssays, 'PHYSICALBIOASSAY'); |
7604 |
25 Feb 19 |
nicklas |
if (ids.length > 0) |
7604 |
25 Feb 19 |
nicklas |
362 |
{ |
7604 |
25 Feb 19 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
7604 |
25 Feb 19 |
nicklas |
var url = '../physicalbioassays/ajax.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=GetAllExtractIds&bioassay_ids=' + ids.join(','); |
7604 |
25 Feb 19 |
nicklas |
request.open("GET", url, false); |
7604 |
25 Feb 19 |
nicklas |
request.send(null); |
7604 |
25 Feb 19 |
nicklas |
var response = JSON.parse(request.responseText); |
7604 |
25 Feb 19 |
nicklas |
if (response.status != 'ok') |
7604 |
25 Feb 19 |
nicklas |
370 |
{ |
7604 |
25 Feb 19 |
nicklas |
alert(response.message); |
7604 |
25 Feb 19 |
nicklas |
return null; |
7604 |
25 Feb 19 |
nicklas |
373 |
} |
7604 |
25 Feb 19 |
nicklas |
relatedExtractIds = response.allExtractIds; |
7604 |
25 Feb 19 |
nicklas |
375 |
} |
7604 |
25 Feb 19 |
nicklas |
376 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (frm.parents && (!frm.isRoot || frm.isRoot[1].checked)) |
7604 |
25 Feb 19 |
nicklas |
378 |
{ |
7604 |
25 Feb 19 |
nicklas |
var ids = Link.getIdsInList(frm.parents, 'DERIVEDBIOASSAY'); |
7604 |
25 Feb 19 |
nicklas |
if (ids.length > 0) |
7604 |
25 Feb 19 |
nicklas |
381 |
{ |
7604 |
25 Feb 19 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
7604 |
25 Feb 19 |
nicklas |
var url = 'ajax.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=GetAllExtractIds&bioassay_ids=' + ids.join(','); |
7604 |
25 Feb 19 |
nicklas |
request.open("GET", url, false); |
7604 |
25 Feb 19 |
nicklas |
request.send(null); |
7604 |
25 Feb 19 |
nicklas |
var response = JSON.parse(request.responseText); |
7604 |
25 Feb 19 |
nicklas |
if (response.status != 'ok') |
7604 |
25 Feb 19 |
nicklas |
389 |
{ |
7604 |
25 Feb 19 |
nicklas |
alert(response.message); |
7604 |
25 Feb 19 |
nicklas |
return null; |
7604 |
25 Feb 19 |
nicklas |
392 |
} |
7604 |
25 Feb 19 |
nicklas |
relatedExtractIds = response.allExtractIds; |
7604 |
25 Feb 19 |
nicklas |
394 |
} |
7604 |
25 Feb 19 |
nicklas |
395 |
} |
7604 |
25 Feb 19 |
nicklas |
396 |
|
7604 |
25 Feb 19 |
nicklas |
var url = '&resetTemporary=1'; |
7604 |
25 Feb 19 |
nicklas |
if (relatedExtractIds) |
7604 |
25 Feb 19 |
nicklas |
399 |
{ |
7604 |
25 Feb 19 |
nicklas |
url += '&tmpfilter:INT:id='+encodeURIComponent(relatedExtractIds.join('|')); |
7604 |
25 Feb 19 |
nicklas |
401 |
} |
7604 |
25 Feb 19 |
nicklas |
url += ItemSubtype.createRelatedFilter('subtype_id', 'EXTRACT'); |
7604 |
25 Feb 19 |
nicklas |
if (frm.extract_id.length > 1) |
7604 |
25 Feb 19 |
nicklas |
404 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Math.abs(parseInt(frm.extract_id[1].value)); |
7604 |
25 Feb 19 |
nicklas |
url += '&item_id='+id; |
7604 |
25 Feb 19 |
nicklas |
407 |
} |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('EXTRACT', 'extract_id', 0, url); |
7604 |
25 Feb 19 |
nicklas |
409 |
} |
7604 |
25 Feb 19 |
nicklas |
410 |
|
7604 |
25 Feb 19 |
nicklas |
return bioassays; |
7604 |
25 Feb 19 |
nicklas |
412 |
}(); |
7604 |
25 Feb 19 |
nicklas |
413 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.onLoad(BioAssays.initPage); |
7604 |
25 Feb 19 |
nicklas |
Doc.addElementInitializer(BioAssays.initElements); |
7604 |
25 Feb 19 |
nicklas |
416 |
|