7604 |
25 Feb 19 |
nicklas |
/* $Id $ |
7604 |
25 Feb 19 |
nicklas |
2 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
Copyright (C) 2012 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 TestWithFile = function() |
7604 |
25 Feb 19 |
nicklas |
27 |
{ |
7604 |
25 Feb 19 |
nicklas |
var test = {}; |
7604 |
25 Feb 19 |
nicklas |
29 |
|
7656 |
19 Mar 19 |
nicklas |
var hasExcelSheetParameter = false; |
7656 |
19 Mar 19 |
nicklas |
var currentExcelSheet; |
7656 |
19 Mar 19 |
nicklas |
32 |
|
7604 |
25 Feb 19 |
nicklas |
test.PRE_QUOTE = '(?!")'; |
7604 |
25 Feb 19 |
nicklas |
test.POST_QUOTE = '(?=")'; |
7604 |
25 Feb 19 |
nicklas |
test.WHITESPACE_OR_QUOTE = '[\\s\\"]*'; |
7604 |
25 Feb 19 |
nicklas |
test.NOT_INSIDE_QUOTE = '(?=(?:[^"]*"[^"]*")*(?![^"]*"))'; |
7604 |
25 Feb 19 |
nicklas |
37 |
|
7604 |
25 Feb 19 |
nicklas |
38 |
/** |
7604 |
25 Feb 19 |
nicklas |
Initialize the page. |
7604 |
25 Feb 19 |
nicklas |
40 |
*/ |
7604 |
25 Feb 19 |
nicklas |
test.initPage = function() |
7604 |
25 Feb 19 |
nicklas |
42 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Buttons |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSave', test.save); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnBrowse', test.selectFile); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('path', 'base-selected', test.setFileCallback); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnParse', test.parseFile); |
7654 |
15 Mar 19 |
nicklas |
49 |
|
7654 |
15 Mar 19 |
nicklas |
Events.addEventHandler('sheet', 'change', test.autoParse); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('maxLines', 'keypress', Events.integerOnly) |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('maxDataColumns', 'keypress', Events.integerOnly) |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('minDataColumns', 'keypress', Events.integerOnly) |
7604 |
25 Feb 19 |
nicklas |
54 |
|
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnHeaderRegexp', test.showPredefined); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSplitterRegexp', test.showPredefined); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnIgnoreRegexp', test.showPredefined); |
7604 |
25 Feb 19 |
nicklas |
58 |
|
7604 |
25 Feb 19 |
nicklas |
test.initParameters(); |
7654 |
15 Mar 19 |
nicklas |
var frm = document.forms['testwithfile']; |
7654 |
15 Mar 19 |
nicklas |
test.getFileInfo(Strings.trim(frm.path.value)); |
7604 |
25 Feb 19 |
nicklas |
62 |
} |
7604 |
25 Feb 19 |
nicklas |
63 |
|
7604 |
25 Feb 19 |
nicklas |
test.initElements = function(element, autoInit) |
7604 |
25 Feb 19 |
nicklas |
65 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (autoInit == 'set-preset') |
7604 |
25 Feb 19 |
nicklas |
67 |
{ |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(element, 'click', test.presetOnClick); |
7604 |
25 Feb 19 |
nicklas |
69 |
} |
7604 |
25 Feb 19 |
nicklas |
70 |
} |
7604 |
25 Feb 19 |
nicklas |
71 |
|
7604 |
25 Feb 19 |
nicklas |
test.selectFile = function() |
7604 |
25 Feb 19 |
nicklas |
73 |
{ |
7604 |
25 Feb 19 |
nicklas |
var url = '&title=Test+with+file'; |
7604 |
25 Feb 19 |
nicklas |
Dialogs.selectItem('FILE', 'path', 0, url); |
7604 |
25 Feb 19 |
nicklas |
76 |
} |
7604 |
25 Feb 19 |
nicklas |
77 |
|
7604 |
25 Feb 19 |
nicklas |
test.setFileCallback = function(event) |
7604 |
25 Feb 19 |
nicklas |
79 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['testwithfile']; |
7604 |
25 Feb 19 |
nicklas |
frm.file_id.value = event.detail.id; |
7604 |
25 Feb 19 |
nicklas |
frm.path.value = event.detail.name; |
7654 |
15 Mar 19 |
nicklas |
test.getFileInfo(event.detail.name, event.detail.id); |
7604 |
25 Feb 19 |
nicklas |
84 |
} |
7604 |
25 Feb 19 |
nicklas |
85 |
|
7654 |
15 Mar 19 |
nicklas |
test.getFileInfo = function(path, fileId) |
7604 |
25 Feb 19 |
nicklas |
87 |
{ |
7604 |
25 Feb 19 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
7604 |
25 Feb 19 |
nicklas |
if (request != null) |
7604 |
25 Feb 19 |
nicklas |
90 |
{ |
7604 |
25 Feb 19 |
nicklas |
var url = App.getRoot()+'filemanager/files/ajax.jsp?ID='+App.getSessionId(); |
7654 |
15 Mar 19 |
nicklas |
url += '&cmd=GetFileInfo&checktype=1'; |
7654 |
15 Mar 19 |
nicklas |
if (fileId) |
7654 |
15 Mar 19 |
nicklas |
94 |
{ |
7654 |
15 Mar 19 |
nicklas |
url += '&item_id=' + fileId; |
7654 |
15 Mar 19 |
nicklas |
96 |
} |
7654 |
15 Mar 19 |
nicklas |
else if (path) |
7654 |
15 Mar 19 |
nicklas |
98 |
{ |
7654 |
15 Mar 19 |
nicklas |
url += '&path=' + encodeURIComponent(path); |
7654 |
15 Mar 19 |
nicklas |
100 |
} |
7654 |
15 Mar 19 |
nicklas |
else |
7654 |
15 Mar 19 |
nicklas |
102 |
{ |
7654 |
15 Mar 19 |
nicklas |
return false; |
7654 |
15 Mar 19 |
nicklas |
104 |
} |
7654 |
15 Mar 19 |
nicklas |
var frm = document.forms['testwithfile']; |
7654 |
15 Mar 19 |
nicklas |
Doc.addClass('btnParse', 'disabled'); |
7654 |
15 Mar 19 |
nicklas |
frm.sheet.disabled = true; |
7654 |
15 Mar 19 |
nicklas |
108 |
|
7604 |
25 Feb 19 |
nicklas |
request.open("GET", url, true); |
7654 |
15 Mar 19 |
nicklas |
Ajax.setReadyStateHandler(request, test.fileInfoCallback); |
7604 |
25 Feb 19 |
nicklas |
request.send(null); |
7604 |
25 Feb 19 |
nicklas |
112 |
} |
7604 |
25 Feb 19 |
nicklas |
return request != null; |
7604 |
25 Feb 19 |
nicklas |
114 |
} |
7604 |
25 Feb 19 |
nicklas |
115 |
|
7654 |
15 Mar 19 |
nicklas |
test.fileInfoCallback = function(request) |
7604 |
25 Feb 19 |
nicklas |
117 |
{ |
7654 |
15 Mar 19 |
nicklas |
var frm = document.forms['testwithfile']; |
7654 |
15 Mar 19 |
nicklas |
Doc.removeClass('btnParse', 'disabled'); |
7654 |
15 Mar 19 |
nicklas |
120 |
|
7604 |
25 Feb 19 |
nicklas |
var response = JSON.parse(request.responseText); |
8013 |
13 Aug 21 |
nicklas |
var excelMode = response.excelMode || false; |
7654 |
15 Mar 19 |
nicklas |
123 |
|
7654 |
15 Mar 19 |
nicklas |
frm.filemode.value = excelMode ? 'excel' : 'csv'; |
7654 |
15 Mar 19 |
nicklas |
Data.set(document.body, 'filemode', frm.filemode.value); |
7654 |
15 Mar 19 |
nicklas |
126 |
|
7654 |
15 Mar 19 |
nicklas |
frm.sheet.length = 0; |
7654 |
15 Mar 19 |
nicklas |
frm.sheet.disabled = !excelMode; |
7654 |
15 Mar 19 |
nicklas |
frm.charset.disabled = excelMode; |
7654 |
15 Mar 19 |
nicklas |
frm.dataSplitter.disabled = excelMode; |
7654 |
15 Mar 19 |
nicklas |
Doc.addOrRemoveClass('btnSplitterRegexp', 'disabled', excelMode); |
7654 |
15 Mar 19 |
nicklas |
frm.trimQuotes.disabled = excelMode; |
7654 |
15 Mar 19 |
nicklas |
if (excelMode) |
7604 |
25 Feb 19 |
nicklas |
134 |
{ |
7654 |
15 Mar 19 |
nicklas |
frm.dataSplitter.value = '\\t'; |
7654 |
15 Mar 19 |
nicklas |
Forms.selectListOption(frm.charset, 'UTF-8'); |
7654 |
15 Mar 19 |
nicklas |
frm.trimQuotes.checked = false; |
7654 |
15 Mar 19 |
nicklas |
for (var i = 0; i < response.sheets.length; i++) |
7654 |
15 Mar 19 |
nicklas |
139 |
{ |
7656 |
19 Mar 19 |
nicklas |
var sheet = response.sheets[i]; |
7656 |
19 Mar 19 |
nicklas |
frm.sheet[frm.sheet.length] = new Option((i+1) + ': '+sheet, sheet, false, currentExcelSheet == sheet); |
7654 |
15 Mar 19 |
nicklas |
142 |
} |
7656 |
19 Mar 19 |
nicklas |
if (!hasExcelSheetParameter && frm.sheet.length > 1) |
7656 |
19 Mar 19 |
nicklas |
144 |
{ |
7656 |
19 Mar 19 |
nicklas |
Doc.show('noSheetSupportWarning', 'inline'); |
7656 |
19 Mar 19 |
nicklas |
146 |
} |
7656 |
19 Mar 19 |
nicklas |
else |
7656 |
19 Mar 19 |
nicklas |
148 |
{ |
7656 |
19 Mar 19 |
nicklas |
Doc.hide('noSheetSupportWarning'); |
7656 |
19 Mar 19 |
nicklas |
150 |
} |
7604 |
25 Feb 19 |
nicklas |
151 |
} |
7654 |
15 Mar 19 |
nicklas |
else |
7654 |
15 Mar 19 |
nicklas |
153 |
{ |
7654 |
15 Mar 19 |
nicklas |
if (charset) |
7654 |
15 Mar 19 |
nicklas |
155 |
{ |
7654 |
15 Mar 19 |
nicklas |
var charset = response.characterSet; |
7654 |
15 Mar 19 |
nicklas |
Forms.selectListOption(frm.charset, charset); |
7654 |
15 Mar 19 |
nicklas |
158 |
} |
7654 |
15 Mar 19 |
nicklas |
frm.trimQuotes.checked = true; |
7654 |
15 Mar 19 |
nicklas |
160 |
} |
7604 |
25 Feb 19 |
nicklas |
test.autoParse(); |
7604 |
25 Feb 19 |
nicklas |
162 |
} |
7604 |
25 Feb 19 |
nicklas |
163 |
|
7604 |
25 Feb 19 |
nicklas |
// Parse the selected file if we have the required parameters |
7604 |
25 Feb 19 |
nicklas |
test.autoParse = function() |
7604 |
25 Feb 19 |
nicklas |
166 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['testwithfile']; |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.path.value) != '' && Strings.trim(frm.dataSplitter.value) != '') |
7604 |
25 Feb 19 |
nicklas |
169 |
{ |
7604 |
25 Feb 19 |
nicklas |
test.parseFile(); |
7604 |
25 Feb 19 |
nicklas |
171 |
} |
7604 |
25 Feb 19 |
nicklas |
172 |
} |
7604 |
25 Feb 19 |
nicklas |
173 |
|
7604 |
25 Feb 19 |
nicklas |
test.parseFile = function() |
7604 |
25 Feb 19 |
nicklas |
175 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['testwithfile']; |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.path.value) == '') |
7604 |
25 Feb 19 |
nicklas |
178 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification('btnBrowse', 'You must select a file'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
181 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (Strings.trim(frm.dataSplitter.value) == '') |
7604 |
25 Feb 19 |
nicklas |
183 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.dataSplitter, 'You must specify a data splitter regular expression'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
186 |
} |
7654 |
15 Mar 19 |
nicklas |
187 |
|
7654 |
15 Mar 19 |
nicklas |
var parseWin = window.frames['parsed']; |
7655 |
19 Mar 19 |
nicklas |
if (parseWin && parseWin.ParseFile) |
7655 |
19 Mar 19 |
nicklas |
190 |
{ |
7655 |
19 Mar 19 |
nicklas |
parseWin.ParseFile.pleaseWaitWhileParsing(); |
7655 |
19 Mar 19 |
nicklas |
192 |
} |
7604 |
25 Feb 19 |
nicklas |
frm.submit(); |
7604 |
25 Feb 19 |
nicklas |
194 |
} |
7604 |
25 Feb 19 |
nicklas |
195 |
|
7604 |
25 Feb 19 |
nicklas |
test.initParameters = function() |
7604 |
25 Feb 19 |
nicklas |
197 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['testwithfile']; |
7604 |
25 Feb 19 |
nicklas |
var configWin = window.opener; |
7604 |
25 Feb 19 |
nicklas |
frm.path.value = configWin.Configure.getParameterValue('file'); |
7604 |
25 Feb 19 |
nicklas |
frm.header.value = configWin.Configure.getParameterValue('headerRegexp'); |
7604 |
25 Feb 19 |
nicklas |
frm.dataHeader.value = configWin.Configure.getParameterValue('dataHeaderRegexp'); |
7604 |
25 Feb 19 |
nicklas |
frm.dataSplitter.value = configWin.Configure.getParameterValue('dataSplitterRegexp'); |
7604 |
25 Feb 19 |
nicklas |
frm.dataFooter.value = configWin.Configure.getParameterValue('dataFooterRegexp'); |
7604 |
25 Feb 19 |
nicklas |
frm.ignore.value = configWin.Configure.getParameterValue('ignoreRegexp'); |
7604 |
25 Feb 19 |
nicklas |
frm.minDataColumns.value = configWin.Configure.getParameterValue('minDataColumns'); |
7604 |
25 Feb 19 |
nicklas |
frm.maxDataColumns.value = configWin.Configure.getParameterValue('maxDataColumns'); |
7604 |
25 Feb 19 |
nicklas |
frm.trimQuotes.checked = configWin.Configure.getParameterValue('trimQuotes') != 'false'; |
7655 |
19 Mar 19 |
nicklas |
frm.decimalSeparator.value = configWin.Configure.getParameterValue('decimalSeparator'); |
7654 |
15 Mar 19 |
nicklas |
frm.dateFormat.value = configWin.Configure.getParameterValue('dateFormat'); |
7655 |
19 Mar 19 |
nicklas |
frm.timestampFormat.value = configWin.Configure.getParameterValue('timestampFormat'); |
7656 |
19 Mar 19 |
nicklas |
hasExcelSheetParameter = configWin.Configure.getParameterDef('excelSheet') != null; |
7656 |
19 Mar 19 |
nicklas |
currentExcelSheet = configWin.Configure.getParameterValue('excelSheet'); |
7656 |
19 Mar 19 |
nicklas |
214 |
|
7627 |
08 Mar 19 |
nicklas |
// Copy the list since ith is not certain that it is the same as Config.allCharsets() |
7627 |
08 Mar 19 |
nicklas |
var allCharsets = configWin.Doc.element('parameter-charset'); |
7627 |
08 Mar 19 |
nicklas |
if (allCharsets) |
7627 |
08 Mar 19 |
nicklas |
218 |
{ |
7627 |
08 Mar 19 |
nicklas |
frm.charset.length = 0; |
7627 |
08 Mar 19 |
nicklas |
for (var i = 0; i < allCharsets.length; i++) |
7627 |
08 Mar 19 |
nicklas |
221 |
{ |
7627 |
08 Mar 19 |
nicklas |
var cs = allCharsets[i]; |
7627 |
08 Mar 19 |
nicklas |
if (cs.value != '') frm.charset[frm.charset.length] = new Option(cs.text, cs.value); |
7627 |
08 Mar 19 |
nicklas |
224 |
} |
7627 |
08 Mar 19 |
nicklas |
225 |
} |
7604 |
25 Feb 19 |
nicklas |
Forms.selectListOption(frm.charset, configWin.Configure.getParameterValue('charset')); |
7604 |
25 Feb 19 |
nicklas |
227 |
|
7604 |
25 Feb 19 |
nicklas |
var allParameters = configWin.Configure.getAllParameters(); |
7604 |
25 Feb 19 |
nicklas |
var parameterNames = []; |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < allParameters.length; i++) |
7604 |
25 Feb 19 |
nicklas |
231 |
{ |
7604 |
25 Feb 19 |
nicklas |
var param = allParameters[i]; |
7604 |
25 Feb 19 |
nicklas |
if (param.name.indexOf('Mapping') >= 0) |
7604 |
25 Feb 19 |
nicklas |
234 |
{ |
7604 |
25 Feb 19 |
nicklas |
parameterNames[parameterNames.length] = param.name; |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, 'mapping.'+param.name+'.label', param.label); |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, 'mapping.'+param.name+'.expression', param.values.length == 0 ? '' : param.values[0]); |
7604 |
25 Feb 19 |
nicklas |
238 |
} |
7604 |
25 Feb 19 |
nicklas |
239 |
} |
7604 |
25 Feb 19 |
nicklas |
if (parameterNames.length > 0) |
7604 |
25 Feb 19 |
nicklas |
241 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.addHidden(frm, 'mappingParameterNames', parameterNames.join(',')); |
7604 |
25 Feb 19 |
nicklas |
243 |
} |
7604 |
25 Feb 19 |
nicklas |
244 |
} |
7604 |
25 Feb 19 |
nicklas |
245 |
|
7604 |
25 Feb 19 |
nicklas |
test.save = function() |
7604 |
25 Feb 19 |
nicklas |
247 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['testwithfile']; |
7604 |
25 Feb 19 |
nicklas |
var configWin = window.opener; |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue('file', frm.path.value); |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue('headerRegexp', frm.header.value); |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue('dataHeaderRegexp', frm.dataHeader.value); |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue('dataSplitterRegexp', frm.dataSplitter.value); |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue('dataFooterRegexp', frm.dataFooter.value); |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue('ignoreRegexp', frm.ignore.value); |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue('minDataColumns', frm.minDataColumns.value); |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue('maxDataColumns', frm.maxDataColumns.value); |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue('trimQuotes', frm.trimQuotes.checked ? 'true' : 'false'); |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue('charset', frm.charset.value); |
7656 |
19 Mar 19 |
nicklas |
configWin.Configure.setParameterValue('excelSheet', frm.sheet.value); |
7604 |
25 Feb 19 |
nicklas |
261 |
|
7604 |
25 Feb 19 |
nicklas |
var allParameters = configWin.Configure.getAllParameters(); |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < allParameters.length; i++) |
7604 |
25 Feb 19 |
nicklas |
264 |
{ |
7604 |
25 Feb 19 |
nicklas |
var name = allParameters[i].name; |
7604 |
25 Feb 19 |
nicklas |
if (name.indexOf('Mapping') >= 0) |
7604 |
25 Feb 19 |
nicklas |
267 |
{ |
7604 |
25 Feb 19 |
nicklas |
configWin.Configure.setParameterValue(name, frm['mapping.'+name+'.expression'].value); |
7604 |
25 Feb 19 |
nicklas |
269 |
} |
7604 |
25 Feb 19 |
nicklas |
270 |
} |
7604 |
25 Feb 19 |
nicklas |
window.close(); |
7604 |
25 Feb 19 |
nicklas |
272 |
} |
7604 |
25 Feb 19 |
nicklas |
273 |
|
7604 |
25 Feb 19 |
nicklas |
test.showPredefined = function(event) |
7604 |
25 Feb 19 |
nicklas |
275 |
{ |
7604 |
25 Feb 19 |
nicklas |
var menu = Data.get(event.currentTarget, 'predefined'); |
7604 |
25 Feb 19 |
nicklas |
Menu.toggleTopMenu(menu, event.clientX, event.clientY); |
7604 |
25 Feb 19 |
nicklas |
event.stopPropagation(); |
7604 |
25 Feb 19 |
nicklas |
279 |
} |
7604 |
25 Feb 19 |
nicklas |
280 |
|
7604 |
25 Feb 19 |
nicklas |
test.presetOnClick = function(event) |
7604 |
25 Feb 19 |
nicklas |
282 |
{ |
7604 |
25 Feb 19 |
nicklas |
var field = Data.get(event.currentTarget, 'field'); |
7604 |
25 Feb 19 |
nicklas |
var value = Data.get(event.currentTarget, 'value'); |
7604 |
25 Feb 19 |
nicklas |
test.setFormValue(field, value); |
7604 |
25 Feb 19 |
nicklas |
286 |
} |
7604 |
25 Feb 19 |
nicklas |
287 |
|
7604 |
25 Feb 19 |
nicklas |
test.setFormValue = function(field, value) |
7604 |
25 Feb 19 |
nicklas |
289 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['testwithfile']; |
7604 |
25 Feb 19 |
nicklas |
frm[field].value = value; |
7604 |
25 Feb 19 |
nicklas |
292 |
} |
7604 |
25 Feb 19 |
nicklas |
293 |
|
7604 |
25 Feb 19 |
nicklas |
return test; |
7604 |
25 Feb 19 |
nicklas |
295 |
}(); |
7604 |
25 Feb 19 |
nicklas |
296 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.onLoad(TestWithFile.initPage); |
7604 |
25 Feb 19 |
nicklas |
Doc.addElementInitializer(TestWithFile.initElements); |