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 Details = function() |
7604 |
25 Feb 19 |
nicklas |
27 |
{ |
7604 |
25 Feb 19 |
nicklas |
var details = {}; |
7604 |
25 Feb 19 |
nicklas |
29 |
|
7604 |
25 Feb 19 |
nicklas |
30 |
|
7604 |
25 Feb 19 |
nicklas |
details.initElements = function(element, autoInit) |
7604 |
25 Feb 19 |
nicklas |
32 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (autoInit == 'show-file') |
7604 |
25 Feb 19 |
nicklas |
34 |
{ |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(element, 'click', details.showFileOnClick); |
7604 |
25 Feb 19 |
nicklas |
36 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (autoInit == 'toggle-stacktrace') |
7604 |
25 Feb 19 |
nicklas |
38 |
{ |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(element, 'click', details.toggleStackTraceOnClick); |
7604 |
25 Feb 19 |
nicklas |
40 |
} |
7604 |
25 Feb 19 |
nicklas |
41 |
} |
7604 |
25 Feb 19 |
nicklas |
Doc.addElementInitializer(details.initElements); |
7604 |
25 Feb 19 |
nicklas |
43 |
|
7604 |
25 Feb 19 |
nicklas |
details.initPage = function() |
7604 |
25 Feb 19 |
nicklas |
45 |
{ |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnInstall', details.installOnClick); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnScanResults', details.scanResultsOnClick); |
7604 |
25 Feb 19 |
nicklas |
48 |
|
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnToggleExtension', details.toggleExtensionOnClick); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnToggleExtensionPoint', details.toggleExtensionPointOnClick); |
8144 |
21 Apr 23 |
nicklas |
Buttons.addClickHandler('btnViewLog', details.viewLog); |
7604 |
25 Feb 19 |
nicklas |
52 |
|
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnEnableFile', details.enableOrDisableFileOnClick); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDisableFile', details.enableOrDisableFileOnClick); |
7604 |
25 Feb 19 |
nicklas |
55 |
} |
7604 |
25 Feb 19 |
nicklas |
56 |
|
7604 |
25 Feb 19 |
nicklas |
57 |
|
7604 |
25 Feb 19 |
nicklas |
details.installOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
59 |
{ |
7604 |
25 Feb 19 |
nicklas |
var url = 'index.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=ManualScan'; |
8032 |
01 Feb 22 |
nicklas |
Dialogs.openPopup(url, 'ManualScan', 1050, 700); |
7604 |
25 Feb 19 |
nicklas |
63 |
} |
7604 |
25 Feb 19 |
nicklas |
64 |
|
7604 |
25 Feb 19 |
nicklas |
details.scanResultsOnClick = function() |
7604 |
25 Feb 19 |
nicklas |
66 |
{ |
7604 |
25 Feb 19 |
nicklas |
var url = 'index.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=ScanResults'; |
7604 |
25 Feb 19 |
nicklas |
Dialogs.openPopup(url, 'ScanResults', 750, 500); |
7604 |
25 Feb 19 |
nicklas |
70 |
} |
7604 |
25 Feb 19 |
nicklas |
71 |
|
8144 |
21 Apr 23 |
nicklas |
details.viewLog = function(event) |
8144 |
21 Apr 23 |
nicklas |
73 |
{ |
8144 |
21 Apr 23 |
nicklas |
var target = event.currentTarget; |
8144 |
21 Apr 23 |
nicklas |
var extensionId = Data.get(target, 'extension-id'); |
8144 |
21 Apr 23 |
nicklas |
var url = 'view_log.jsp?ID='+App.getSessionId(); |
8144 |
21 Apr 23 |
nicklas |
url += '&extensionId='+extensionId; |
8144 |
21 Apr 23 |
nicklas |
Dialogs.openPopup(url, 'ViewLog'+extensionId, 1000, 600); |
8144 |
21 Apr 23 |
nicklas |
79 |
} |
8144 |
21 Apr 23 |
nicklas |
80 |
|
7604 |
25 Feb 19 |
nicklas |
details.toggleExtensionOnClick = function(event) |
7604 |
25 Feb 19 |
nicklas |
82 |
{ |
7604 |
25 Feb 19 |
nicklas |
var target = event.currentTarget; |
7604 |
25 Feb 19 |
nicklas |
var extensionId = Data.get(target, 'extension-id'); |
7604 |
25 Feb 19 |
nicklas |
var isEnabled = Data.int(target, 'is-enabled'); |
7604 |
25 Feb 19 |
nicklas |
86 |
|
7604 |
25 Feb 19 |
nicklas |
var iconName = isEnabled ? 'ExtensionDisabled' : 'Extension'; |
7604 |
25 Feb 19 |
nicklas |
window.parent.frames['tree'].Tree.setIcon(extensionId, iconName); |
7604 |
25 Feb 19 |
nicklas |
89 |
|
7604 |
25 Feb 19 |
nicklas |
var url = 'index.jsp?ID=' + App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=EnableExtension&extensionId='+extensionId; |
7604 |
25 Feb 19 |
nicklas |
url += '&enable='+(isEnabled ? 0 : 1); |
7604 |
25 Feb 19 |
nicklas |
location.replace(url); |
7604 |
25 Feb 19 |
nicklas |
94 |
} |
7604 |
25 Feb 19 |
nicklas |
95 |
|
7604 |
25 Feb 19 |
nicklas |
details.toggleExtensionPointOnClick = function(event) |
7604 |
25 Feb 19 |
nicklas |
97 |
{ |
7604 |
25 Feb 19 |
nicklas |
var target = event.currentTarget; |
7604 |
25 Feb 19 |
nicklas |
var extensionPointId = Data.get(target, 'extension-point-id'); |
7604 |
25 Feb 19 |
nicklas |
var isEnabled = Data.int(target, 'is-enabled'); |
7604 |
25 Feb 19 |
nicklas |
101 |
|
7604 |
25 Feb 19 |
nicklas |
var iconName = isEnabled ? 'ExtensionPointDisabled' : 'ExtensionPoint'; |
7604 |
25 Feb 19 |
nicklas |
window.parent.frames['tree'].Tree.setIcon(extensionPointId, iconName); |
7604 |
25 Feb 19 |
nicklas |
104 |
|
7604 |
25 Feb 19 |
nicklas |
var url = 'index.jsp?ID=' + App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=EnableExtensionPoint&extensionPointId='+extensionPointId; |
7604 |
25 Feb 19 |
nicklas |
url += '&enable='+(isEnabled ? 0 : 1); |
7604 |
25 Feb 19 |
nicklas |
location.replace(url); |
7604 |
25 Feb 19 |
nicklas |
109 |
} |
7604 |
25 Feb 19 |
nicklas |
110 |
|
7604 |
25 Feb 19 |
nicklas |
details.enableOrDisableFileOnClick = function(event) |
7604 |
25 Feb 19 |
nicklas |
112 |
{ |
7604 |
25 Feb 19 |
nicklas |
var target = event.currentTarget; |
7604 |
25 Feb 19 |
nicklas |
var fileName = Data.get(target, 'file-name'); |
7604 |
25 Feb 19 |
nicklas |
var fileUri = Data.get(target, 'file-uri'); |
7604 |
25 Feb 19 |
nicklas |
var enable = Data.int(target, 'enable'); |
7604 |
25 Feb 19 |
nicklas |
117 |
|
7604 |
25 Feb 19 |
nicklas |
window.parent.frames['tree'].Tree.setChildIcons(fileName, enable); |
7604 |
25 Feb 19 |
nicklas |
var url = 'index.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=EnableFile'; |
7604 |
25 Feb 19 |
nicklas |
url += '&fileuri='+encodeURIComponent(fileUri); |
7604 |
25 Feb 19 |
nicklas |
url += '&enable='+enable; |
7604 |
25 Feb 19 |
nicklas |
location.replace(url); |
7604 |
25 Feb 19 |
nicklas |
124 |
} |
7604 |
25 Feb 19 |
nicklas |
125 |
|
7604 |
25 Feb 19 |
nicklas |
details.showFileOnClick = function(event) |
7604 |
25 Feb 19 |
nicklas |
127 |
{ |
7604 |
25 Feb 19 |
nicklas |
var target = event.currentTarget; |
7604 |
25 Feb 19 |
nicklas |
var fileUri = Data.get(target, 'file-uri'); |
7604 |
25 Feb 19 |
nicklas |
window.parent.frames['tree'].Tree.selectFile(fileUri); |
7604 |
25 Feb 19 |
nicklas |
131 |
} |
7604 |
25 Feb 19 |
nicklas |
132 |
|
7604 |
25 Feb 19 |
nicklas |
details.toggleStackTraceOnClick = function(event) |
7604 |
25 Feb 19 |
nicklas |
134 |
{ |
7604 |
25 Feb 19 |
nicklas |
var target = event.currentTarget; |
7604 |
25 Feb 19 |
nicklas |
var stackTraceId = Data.get(target, 'stacktrace-id'); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide(stackTraceId); |
7604 |
25 Feb 19 |
nicklas |
138 |
} |
7604 |
25 Feb 19 |
nicklas |
139 |
|
7604 |
25 Feb 19 |
nicklas |
return details; |
7604 |
25 Feb 19 |
nicklas |
141 |
}(); |
7604 |
25 Feb 19 |
nicklas |
142 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.onLoad(Details.initPage); |