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 Formulas = function() |
7604 |
25 Feb 19 |
nicklas |
27 |
{ |
7604 |
25 Feb 19 |
nicklas |
var formulas = {}; |
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 |
formulas.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', formulas.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.addTabValidator('settings.info', formulas.validateFormula); |
7604 |
25 Feb 19 |
nicklas |
44 |
|
7604 |
25 Feb 19 |
nicklas |
// Channels |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('channels', 'keypress', Events.integerOnly); |
7604 |
25 Feb 19 |
nicklas |
47 |
|
7604 |
25 Feb 19 |
nicklas |
// Color values |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('useColors', 'click', formulas.useColorsOnClick); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('min_value', 'keypress', Events.numberOnly); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('mid_value', 'keypress', Events.numberOnly); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('max_value', 'keypress', Events.numberOnly); |
7604 |
25 Feb 19 |
nicklas |
53 |
|
7604 |
25 Feb 19 |
nicklas |
// Raw data type |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('rawdatatype', 'change', formulas.rawDataTypeOnChange); |
7604 |
25 Feb 19 |
nicklas |
56 |
|
7604 |
25 Feb 19 |
nicklas |
// Formula type |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('formulaType', 'change', formulas.formulaTypeOnChange); |
7604 |
25 Feb 19 |
nicklas |
formulas.formulaTypeOnChange(); |
7604 |
25 Feb 19 |
nicklas |
60 |
|
7604 |
25 Feb 19 |
nicklas |
// Expressions |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('expressions', 'change', formulas.expressionsOnClick); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('expression', 'keyup', formulas.expressionOnBlur); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('expression', 'change', formulas.expressionOnChange); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnRemoveExpression', formulas.removeOnClick); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnAddExpression', formulas.addOnClick); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnExpressionBuilder', formulas.openExpressionBuilder); |
7604 |
25 Feb 19 |
nicklas |
68 |
|
7604 |
25 Feb 19 |
nicklas |
69 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (pageId == 'view-page') |
7604 |
25 Feb 19 |
nicklas |
71 |
{ |
7604 |
25 Feb 19 |
nicklas |
var itemId = Data.get('page-data', 'item-id'); |
7604 |
25 Feb 19 |
nicklas |
var attributes = {'item-type': 'FORMULA', 'item-id': itemId}; |
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('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 |
84 |
|
7604 |
25 Feb 19 |
nicklas |
TabControl.addTabActivateListener('main.history', History.loadOnce); |
7604 |
25 Feb 19 |
nicklas |
86 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (pageId == 'list-page') |
7604 |
25 Feb 19 |
nicklas |
88 |
{ |
7604 |
25 Feb 19 |
nicklas |
var attributes = {'item-type': 'FORMULA'}; |
7604 |
25 Feb 19 |
nicklas |
var tableAttributes = {'table-id': 'formulas'}; |
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('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 |
100 |
|
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 |
103 |
} |
7604 |
25 Feb 19 |
nicklas |
104 |
} |
7604 |
25 Feb 19 |
nicklas |
105 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.validateFormula = function() |
7604 |
25 Feb 19 |
nicklas |
107 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.name.value) == '') |
7604 |
25 Feb 19 |
nicklas |
110 |
{ |
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 |
113 |
} |
7604 |
25 Feb 19 |
nicklas |
114 |
|
7604 |
25 Feb 19 |
nicklas |
var type = frm.type.value; |
7604 |
25 Feb 19 |
nicklas |
var numFormulas = frm.expressions.length; |
7604 |
25 Feb 19 |
nicklas |
var numChannels = frm.channels.value; |
7604 |
25 Feb 19 |
nicklas |
if (type == 'INTENSITY_EXPRESSION' || type == 'INTENSITY_TRANSFORMATION') |
7604 |
25 Feb 19 |
nicklas |
119 |
{ |
7604 |
25 Feb 19 |
nicklas |
// One formula per channel required |
7604 |
25 Feb 19 |
nicklas |
if (numFormulas != numChannels) |
7604 |
25 Feb 19 |
nicklas |
122 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.expressions, 'You must enter one formula per channel for type = ' + frm.type[frm.type.selectedIndex].text, null, 'pointer-left'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
125 |
} |
7604 |
25 Feb 19 |
nicklas |
126 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
128 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Only one formula can be specified |
7604 |
25 Feb 19 |
nicklas |
if (numFormulas != 1) |
7604 |
25 Feb 19 |
nicklas |
131 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.expressions, 'You must enter exactly one formula for type = ' + frm.type[frm.type.selectedIndex].text, null, 'pointer-left'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
134 |
} |
7604 |
25 Feb 19 |
nicklas |
135 |
} |
7604 |
25 Feb 19 |
nicklas |
136 |
|
7604 |
25 Feb 19 |
nicklas |
if (frm.use_colors.checked && !frm.use_colors.disabled) |
7604 |
25 Feb 19 |
nicklas |
138 |
{ |
7604 |
25 Feb 19 |
nicklas |
var minValue = parseFloat(frm.min_value.value); |
7604 |
25 Feb 19 |
nicklas |
var midValue = parseFloat(frm.mid_value.value); |
7604 |
25 Feb 19 |
nicklas |
var maxValue = parseFloat(frm.max_value.value); |
7604 |
25 Feb 19 |
nicklas |
if (isNaN(minValue)) |
7604 |
25 Feb 19 |
nicklas |
143 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.min_value, 'No min value has been specified'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
146 |
} |
7604 |
25 Feb 19 |
nicklas |
if (isNaN(midValue)) |
7604 |
25 Feb 19 |
nicklas |
148 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.mid_value, 'No mid value has been specified'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
151 |
} |
7604 |
25 Feb 19 |
nicklas |
if (isNaN(maxValue)) |
7604 |
25 Feb 19 |
nicklas |
153 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.max_value, 'No max value has been specified'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
156 |
} |
7604 |
25 Feb 19 |
nicklas |
if (minValue > midValue) |
7604 |
25 Feb 19 |
nicklas |
158 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.mid_value, 'The mid value must be greater than the min value'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
161 |
} |
7604 |
25 Feb 19 |
nicklas |
if (midValue > maxValue) |
7604 |
25 Feb 19 |
nicklas |
163 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.max_value, 'The max value must be greater than the mid value'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
166 |
} |
7604 |
25 Feb 19 |
nicklas |
167 |
} |
7604 |
25 Feb 19 |
nicklas |
return true; |
7604 |
25 Feb 19 |
nicklas |
169 |
} |
7604 |
25 Feb 19 |
nicklas |
170 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.save = function() |
7604 |
25 Feb 19 |
nicklas |
172 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
if (TabControl.validateActiveTab('settings')) |
7604 |
25 Feb 19 |
nicklas |
175 |
{ |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < frm.expressions.length; i++) |
7604 |
25 Feb 19 |
nicklas |
177 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, 'formulas', frm.expressions[i].text); |
7604 |
25 Feb 19 |
nicklas |
179 |
} |
7604 |
25 Feb 19 |
nicklas |
frm.channels.disabled = false; // Otherwise the channels info, isn't sent |
7604 |
25 Feb 19 |
nicklas |
frm.submit(); |
7604 |
25 Feb 19 |
nicklas |
182 |
} |
7604 |
25 Feb 19 |
nicklas |
183 |
} |
7604 |
25 Feb 19 |
nicklas |
184 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.useColorsOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
186 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
var useColors = frm.use_colors.checked && !frm.use_colors.disabled; |
7604 |
25 Feb 19 |
nicklas |
frm.min_value.disabled = !useColors; |
7604 |
25 Feb 19 |
nicklas |
frm.mid_value.disabled = !useColors; |
7604 |
25 Feb 19 |
nicklas |
frm.max_value.disabled = !useColors; |
7604 |
25 Feb 19 |
nicklas |
frm.logarithmic.disabled = !useColors; |
7604 |
25 Feb 19 |
nicklas |
if (useColors) |
7604 |
25 Feb 19 |
nicklas |
194 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.addClass(frm.min_value, 'required'); |
7604 |
25 Feb 19 |
nicklas |
Doc.addClass(frm.mid_value, 'required'); |
7604 |
25 Feb 19 |
nicklas |
Doc.addClass(frm.max_value, 'required'); |
7604 |
25 Feb 19 |
nicklas |
198 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
200 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.removeClass(frm.min_value, 'required'); |
7604 |
25 Feb 19 |
nicklas |
Doc.removeClass(frm.mid_value, 'required'); |
7604 |
25 Feb 19 |
nicklas |
Doc.removeClass(frm.max_value, 'required'); |
7604 |
25 Feb 19 |
nicklas |
204 |
} |
7604 |
25 Feb 19 |
nicklas |
205 |
} |
7604 |
25 Feb 19 |
nicklas |
206 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.rawDataTypeOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
208 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
var rawDataType = frm.rawdatatype[frm.rawdatatype.selectedIndex]; |
7604 |
25 Feb 19 |
nicklas |
if (rawDataType.value != '') |
7604 |
25 Feb 19 |
nicklas |
212 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.channels.value = Data.get(rawDataType, 'channels'); |
7604 |
25 Feb 19 |
nicklas |
frm.channels.disabled = true; |
7604 |
25 Feb 19 |
nicklas |
Doc.addClass(frm.channels, 'disabled'); |
7604 |
25 Feb 19 |
nicklas |
Doc.removeClass(frm.channels, 'required'); |
7604 |
25 Feb 19 |
nicklas |
217 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
219 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.channels.disabled = false; |
7604 |
25 Feb 19 |
nicklas |
Doc.removeClass(frm.channels, 'disabled'); |
7604 |
25 Feb 19 |
nicklas |
Doc.addClass(frm.channels, 'required'); |
7604 |
25 Feb 19 |
nicklas |
223 |
} |
7604 |
25 Feb 19 |
nicklas |
224 |
} |
7604 |
25 Feb 19 |
nicklas |
225 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.formulaTypeOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
227 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
var formulaType = frm.type[frm.type.selectedIndex]; |
7604 |
25 Feb 19 |
nicklas |
230 |
|
7604 |
25 Feb 19 |
nicklas |
// Enable/disable colors |
7604 |
25 Feb 19 |
nicklas |
frm.use_colors.disabled = !Data.int(formulaType, 'supports-colors'); |
7604 |
25 Feb 19 |
nicklas |
formulas.useColorsOnClick(); |
7604 |
25 Feb 19 |
nicklas |
234 |
|
7604 |
25 Feb 19 |
nicklas |
// Enable/disable average method |
7604 |
25 Feb 19 |
nicklas |
var supportsAvg = Data.int(formulaType, 'supports-average'); |
7604 |
25 Feb 19 |
nicklas |
frm.averageMethod.disabled = !supportsAvg; |
7604 |
25 Feb 19 |
nicklas |
if (!supportsAvg) frm.averageMethod.selectedIndex = 0; |
7604 |
25 Feb 19 |
nicklas |
239 |
|
7604 |
25 Feb 19 |
nicklas |
// Value type |
7604 |
25 Feb 19 |
nicklas |
var valueType = Data.get(formulaType, 'value-type'); |
7604 |
25 Feb 19 |
nicklas |
if (valueType) |
7604 |
25 Feb 19 |
nicklas |
243 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.selectListOption(frm.valueType, valueType); |
7604 |
25 Feb 19 |
nicklas |
frm.valueType.disabled = true; |
7604 |
25 Feb 19 |
nicklas |
246 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
248 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.valueType.disabled = false; |
7604 |
25 Feb 19 |
nicklas |
250 |
} |
7604 |
25 Feb 19 |
nicklas |
251 |
} |
7604 |
25 Feb 19 |
nicklas |
252 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.expressionsOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
254 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
var selectedExpressionIndex = frm.expressions.selectedIndex; |
7604 |
25 Feb 19 |
nicklas |
if (selectedExpressionIndex >= 0) |
7604 |
25 Feb 19 |
nicklas |
258 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.expression.value = frm.expressions[selectedExpressionIndex].text; |
7604 |
25 Feb 19 |
nicklas |
Data.set(frm.expression, 'linked-index', selectedExpressionIndex); |
7604 |
25 Feb 19 |
nicklas |
261 |
} |
7604 |
25 Feb 19 |
nicklas |
262 |
} |
7604 |
25 Feb 19 |
nicklas |
263 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.expressionOnBlur = function() |
7604 |
25 Feb 19 |
nicklas |
265 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
var selectedExpressionIndex = Data.int(frm.expression, 'linked-index', -1); |
7604 |
25 Feb 19 |
nicklas |
if (selectedExpressionIndex >= 0) |
7604 |
25 Feb 19 |
nicklas |
269 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.expressions[selectedExpressionIndex].text = frm.expression.value; |
7604 |
25 Feb 19 |
nicklas |
271 |
} |
7604 |
25 Feb 19 |
nicklas |
272 |
} |
7604 |
25 Feb 19 |
nicklas |
273 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.removeOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
275 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
for (var i = frm.expressions.length-1; i >= 0; i--) |
7604 |
25 Feb 19 |
nicklas |
278 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (frm.expressions[i].selected) frm.expressions[i] = null; |
7604 |
25 Feb 19 |
nicklas |
280 |
} |
7604 |
25 Feb 19 |
nicklas |
frm.expression.value = ''; |
7604 |
25 Feb 19 |
nicklas |
Data.set(frm.expression, 'linked-index', -1); |
7604 |
25 Feb 19 |
nicklas |
283 |
} |
7604 |
25 Feb 19 |
nicklas |
284 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.addOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
286 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
if (frm.expression.value != '') |
7604 |
25 Feb 19 |
nicklas |
289 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.expressions[frm.expressions.length] = new Option(frm.expression.value); |
7604 |
25 Feb 19 |
nicklas |
frm.expressions.selectedIndex = frm.expressions.length - 1; |
7604 |
25 Feb 19 |
nicklas |
Data.set(frm.expression, 'linked-index', frm.expressions.selectedIndex); |
7604 |
25 Feb 19 |
nicklas |
293 |
} |
7604 |
25 Feb 19 |
nicklas |
294 |
} |
7604 |
25 Feb 19 |
nicklas |
295 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.openExpressionBuilder = function() |
7604 |
25 Feb 19 |
nicklas |
297 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
var rdt = frm.rawdatatype.value; |
7604 |
25 Feb 19 |
nicklas |
var formulaType = frm.type.value; |
7604 |
25 Feb 19 |
nicklas |
var channels = frm.channels.value; |
7604 |
25 Feb 19 |
nicklas |
var restrictions = formulaType == 'COLUMN_RESTRICTION'; |
7604 |
25 Feb 19 |
nicklas |
Dialogs.openExpressionBuilder('expression', 'Expression', formulaType, rdt, channels) |
7604 |
25 Feb 19 |
nicklas |
304 |
} |
7604 |
25 Feb 19 |
nicklas |
305 |
|
7604 |
25 Feb 19 |
nicklas |
306 |
|
7604 |
25 Feb 19 |
nicklas |
formulas.expressionOnChange = function(event) |
7604 |
25 Feb 19 |
nicklas |
308 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['formula']; |
7604 |
25 Feb 19 |
nicklas |
if (frm.expressions.length == 0) |
7604 |
25 Feb 19 |
nicklas |
311 |
{ |
7604 |
25 Feb 19 |
nicklas |
formulas.addOnClick(); |
7604 |
25 Feb 19 |
nicklas |
313 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
315 |
{ |
7604 |
25 Feb 19 |
nicklas |
formulas.expressionOnBlur(); |
7604 |
25 Feb 19 |
nicklas |
317 |
} |
7604 |
25 Feb 19 |
nicklas |
318 |
} |
7604 |
25 Feb 19 |
nicklas |
319 |
|
7604 |
25 Feb 19 |
nicklas |
return formulas; |
7604 |
25 Feb 19 |
nicklas |
321 |
}(); |
7604 |
25 Feb 19 |
nicklas |
322 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.onLoad(Formulas.initPage); |