8128 |
10 Mar 23 |
nicklas |
/* $Id$ |
8128 |
10 Mar 23 |
nicklas |
2 |
------------------------------------------------------------------ |
8128 |
10 Mar 23 |
nicklas |
Copyright (C) 2023 Nicklas Nordborg |
8128 |
10 Mar 23 |
nicklas |
4 |
|
8128 |
10 Mar 23 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
8128 |
10 Mar 23 |
nicklas |
Available at http://base.thep.lu.se/ |
8128 |
10 Mar 23 |
nicklas |
7 |
|
8128 |
10 Mar 23 |
nicklas |
BASE is free software; you can redistribute it and/or |
8128 |
10 Mar 23 |
nicklas |
modify it under the terms of the GNU General Public License |
8128 |
10 Mar 23 |
nicklas |
as published by the Free Software Foundation; either version 3 |
8128 |
10 Mar 23 |
nicklas |
of the License, or (at your option) any later version. |
8128 |
10 Mar 23 |
nicklas |
12 |
|
8128 |
10 Mar 23 |
nicklas |
BASE is distributed in the hope that it will be useful, |
8128 |
10 Mar 23 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
8128 |
10 Mar 23 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8128 |
10 Mar 23 |
nicklas |
GNU General Public License for more details. |
8128 |
10 Mar 23 |
nicklas |
17 |
|
8128 |
10 Mar 23 |
nicklas |
You should have received a copy of the GNU General Public License |
8128 |
10 Mar 23 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
8128 |
10 Mar 23 |
nicklas |
20 |
------------------------------------------------------------------ |
8128 |
10 Mar 23 |
nicklas |
21 |
|
8128 |
10 Mar 23 |
nicklas |
@author Nicklas |
8128 |
10 Mar 23 |
nicklas |
23 |
*/ |
8128 |
10 Mar 23 |
nicklas |
'use strict'; |
8128 |
10 Mar 23 |
nicklas |
25 |
|
8128 |
10 Mar 23 |
nicklas |
var ViewLog = function() |
8128 |
10 Mar 23 |
nicklas |
27 |
{ |
8128 |
10 Mar 23 |
nicklas |
var vlog = {}; |
8128 |
10 Mar 23 |
nicklas |
29 |
|
8128 |
10 Mar 23 |
nicklas |
vlog.initPage = function() |
8128 |
10 Mar 23 |
nicklas |
31 |
{ |
8128 |
10 Mar 23 |
nicklas |
// Close button |
8128 |
10 Mar 23 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
8129 |
14 Mar 23 |
nicklas |
34 |
|
8129 |
14 Mar 23 |
nicklas |
Buttons.addClickHandler('btnUpdate', App.reloadWindow); |
8128 |
10 Mar 23 |
nicklas |
Buttons.addClickHandler('btnClearLog', vlog.clearLog); |
8128 |
10 Mar 23 |
nicklas |
Events.addEventHandler('enableDebug', 'change', vlog.setOptions); |
8128 |
10 Mar 23 |
nicklas |
Events.addEventHandler('copyToStdout', 'change', vlog.setOptions); |
8128 |
10 Mar 23 |
nicklas |
39 |
|
8128 |
10 Mar 23 |
nicklas |
// Auto-update timer |
8128 |
10 Mar 23 |
nicklas |
setInterval(vlog.autoUpdate, 5000); |
8128 |
10 Mar 23 |
nicklas |
42 |
} |
8128 |
10 Mar 23 |
nicklas |
43 |
|
8128 |
10 Mar 23 |
nicklas |
vlog.initElements = function(element, autoInit) |
8128 |
10 Mar 23 |
nicklas |
45 |
{ |
8128 |
10 Mar 23 |
nicklas |
if (autoInit == 'toggle-stacktrace') |
8128 |
10 Mar 23 |
nicklas |
47 |
{ |
8128 |
10 Mar 23 |
nicklas |
Buttons.addClickHandler(element, vlog.toggleStacktrace); |
8128 |
10 Mar 23 |
nicklas |
49 |
} |
8128 |
10 Mar 23 |
nicklas |
50 |
} |
8128 |
10 Mar 23 |
nicklas |
51 |
|
8128 |
10 Mar 23 |
nicklas |
vlog.toggleStacktrace = function(event) |
8128 |
10 Mar 23 |
nicklas |
53 |
{ |
8128 |
10 Mar 23 |
nicklas |
var extensionId = Data.get(event.currentTarget, 'extension-id'); |
8128 |
10 Mar 23 |
nicklas |
Doc.showHide('stacktrace.' + extensionId); |
8128 |
10 Mar 23 |
nicklas |
56 |
|
8128 |
10 Mar 23 |
nicklas |
var img = event.currentTarget.firstChild; |
8128 |
10 Mar 23 |
nicklas |
if (img.src.indexOf('gonext') > 0) |
8128 |
10 Mar 23 |
nicklas |
59 |
{ |
8128 |
10 Mar 23 |
nicklas |
img.src = App.getRoot() + '/images/move_down.png'; |
8128 |
10 Mar 23 |
nicklas |
61 |
} |
8128 |
10 Mar 23 |
nicklas |
else if (img.src.indexOf('move_down') > 0) |
8128 |
10 Mar 23 |
nicklas |
63 |
{ |
8128 |
10 Mar 23 |
nicklas |
img.src = App.getRoot() + '/images/gonext.png'; |
8128 |
10 Mar 23 |
nicklas |
65 |
} |
8128 |
10 Mar 23 |
nicklas |
66 |
} |
8128 |
10 Mar 23 |
nicklas |
67 |
|
8128 |
10 Mar 23 |
nicklas |
vlog.clearLog = function() |
8128 |
10 Mar 23 |
nicklas |
69 |
{ |
8128 |
10 Mar 23 |
nicklas |
var extensionId = Data.get('page-data', 'extension-id'); |
8128 |
10 Mar 23 |
nicklas |
var url = 'index.jsp?ID='+App.getSessionId(); |
8128 |
10 Mar 23 |
nicklas |
url += '&cmd=ClearLog'; |
8128 |
10 Mar 23 |
nicklas |
url += '&extensionId='+extensionId; |
8128 |
10 Mar 23 |
nicklas |
location.replace(url); |
8128 |
10 Mar 23 |
nicklas |
75 |
} |
8128 |
10 Mar 23 |
nicklas |
76 |
|
8128 |
10 Mar 23 |
nicklas |
vlog.setOptions = function() |
8128 |
10 Mar 23 |
nicklas |
78 |
{ |
8128 |
10 Mar 23 |
nicklas |
var extensionId = Data.get('page-data', 'extension-id'); |
8128 |
10 Mar 23 |
nicklas |
var url = 'index.jsp?ID='+App.getSessionId(); |
8128 |
10 Mar 23 |
nicklas |
url += '&cmd=SetLogOptions'; |
8128 |
10 Mar 23 |
nicklas |
url += '&extensionId='+extensionId; |
8128 |
10 Mar 23 |
nicklas |
url += '&enableDebug='+(Doc.element('enableDebug').checked?1:0); |
8128 |
10 Mar 23 |
nicklas |
url += '©ToStdout='+(Doc.element('copyToStdout').checked?1:0); |
8128 |
10 Mar 23 |
nicklas |
url += '&autoUpdate='+(Doc.element('autoUpdate').checked?1:0);; |
8128 |
10 Mar 23 |
nicklas |
location.replace(url); |
8128 |
10 Mar 23 |
nicklas |
87 |
} |
8128 |
10 Mar 23 |
nicklas |
88 |
|
8128 |
10 Mar 23 |
nicklas |
vlog.autoUpdate = function() |
8128 |
10 Mar 23 |
nicklas |
90 |
{ |
8128 |
10 Mar 23 |
nicklas |
if (Doc.element('autoUpdate').checked) |
8128 |
10 Mar 23 |
nicklas |
92 |
{ |
8128 |
10 Mar 23 |
nicklas |
var extensionId = Data.get('page-data', 'extension-id'); |
8128 |
10 Mar 23 |
nicklas |
var url = 'view_log.jsp?ID='+App.getSessionId(); |
8128 |
10 Mar 23 |
nicklas |
url += '&extensionId='+extensionId; |
8128 |
10 Mar 23 |
nicklas |
url += '&autoUpdate=1'; |
8128 |
10 Mar 23 |
nicklas |
location.replace(url); |
8128 |
10 Mar 23 |
nicklas |
98 |
} |
8128 |
10 Mar 23 |
nicklas |
99 |
} |
8128 |
10 Mar 23 |
nicklas |
100 |
|
8128 |
10 Mar 23 |
nicklas |
return vlog; |
8128 |
10 Mar 23 |
nicklas |
102 |
}(); |
8128 |
10 Mar 23 |
nicklas |
103 |
|
8128 |
10 Mar 23 |
nicklas |
Doc.addElementInitializer(ViewLog.initElements); |
8128 |
10 Mar 23 |
nicklas |
Doc.onLoad(ViewLog.initPage); |