7604 |
25 Feb 19 |
nicklas |
/* $Id $ |
7604 |
25 Feb 19 |
nicklas |
2 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
Copyright (C) 2010 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 |
JavaScript functions used on exception handler pages. |
7604 |
25 Feb 19 |
nicklas |
23 |
|
7604 |
25 Feb 19 |
nicklas |
@author Nicklas |
7604 |
25 Feb 19 |
nicklas |
@version 2.16 |
7604 |
25 Feb 19 |
nicklas |
26 |
*/ |
7604 |
25 Feb 19 |
nicklas |
'use strict'; |
7604 |
25 Feb 19 |
nicklas |
28 |
|
7604 |
25 Feb 19 |
nicklas |
var Exception = function() |
7604 |
25 Feb 19 |
nicklas |
30 |
{ |
7604 |
25 Feb 19 |
nicklas |
var exception = {}; |
7604 |
25 Feb 19 |
nicklas |
32 |
|
7604 |
25 Feb 19 |
nicklas |
exception.initPage = function() |
7604 |
25 Feb 19 |
nicklas |
34 |
{ |
7604 |
25 Feb 19 |
nicklas |
var resizeIfPopup = Data.int(document.body, 'resize-if-popup', 0); |
7604 |
25 Feb 19 |
nicklas |
36 |
|
7604 |
25 Feb 19 |
nicklas |
exception.fixWindow(resizeIfPopup); |
7604 |
25 Feb 19 |
nicklas |
38 |
|
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('goback', exception.goBack); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('reportbug', exception.reportBug); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('showMoreDetails', exception.showMoreDetails); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('continuePluginWizard', exception.continuePluginWizard); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('gologin', exception.goLogin); |
7813 |
19 May 20 |
nicklas |
Buttons.addClickHandler('gologin2', exception.goLogin); |
7604 |
25 Feb 19 |
nicklas |
46 |
} |
7604 |
25 Feb 19 |
nicklas |
47 |
|
7604 |
25 Feb 19 |
nicklas |
exception.fixWindow = function(resizeIfPopup) |
7604 |
25 Feb 19 |
nicklas |
49 |
{ |
7604 |
25 Feb 19 |
nicklas |
var topWindow = window.top; |
7604 |
25 Feb 19 |
nicklas |
var isPopup = topWindow.opener != null; |
7604 |
25 Feb 19 |
nicklas |
if (history.length <= 1) |
7604 |
25 Feb 19 |
nicklas |
53 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.hide('goback'); |
7604 |
25 Feb 19 |
nicklas |
55 |
} |
7604 |
25 Feb 19 |
nicklas |
if (isPopup) |
7604 |
25 Feb 19 |
nicklas |
57 |
{ |
7604 |
25 Feb 19 |
nicklas |
// popup window --> Hide menubar |
7604 |
25 Feb 19 |
nicklas |
Doc.hide('menubar'); |
7604 |
25 Feb 19 |
nicklas |
document.body.className = 'popup'; |
7604 |
25 Feb 19 |
nicklas |
if (resizeIfPopup) |
7604 |
25 Feb 19 |
nicklas |
62 |
{ |
7604 |
25 Feb 19 |
nicklas |
var pos = App.getWindowPosition(topWindow); |
7604 |
25 Feb 19 |
nicklas |
if (pos.height < 600 || pos.width < 800) |
7604 |
25 Feb 19 |
nicklas |
65 |
{ |
7604 |
25 Feb 19 |
nicklas |
topWindow.resizeTo(Math.max(800, pos.width), Math.max(600, pos.height)); |
7604 |
25 Feb 19 |
nicklas |
67 |
} |
7604 |
25 Feb 19 |
nicklas |
68 |
} |
7604 |
25 Feb 19 |
nicklas |
69 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
71 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Hide close button |
7604 |
25 Feb 19 |
nicklas |
Doc.hide('close'); |
7604 |
25 Feb 19 |
nicklas |
// If inside a second frameset, hide menubar |
7604 |
25 Feb 19 |
nicklas |
if (window.parent != window.top) |
7604 |
25 Feb 19 |
nicklas |
76 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.hide('menubar'); |
7604 |
25 Feb 19 |
nicklas |
78 |
} |
7604 |
25 Feb 19 |
nicklas |
79 |
} |
7604 |
25 Feb 19 |
nicklas |
80 |
|
7604 |
25 Feb 19 |
nicklas |
var notify = Data.get(topWindow.document.body, 'notify-on-error'); |
7604 |
25 Feb 19 |
nicklas |
if (notify) |
7604 |
25 Feb 19 |
nicklas |
83 |
{ |
7604 |
25 Feb 19 |
nicklas |
Events.sendCustomEvent(topWindow.document.body, 'base-notify', {'errorWindow': window.name}); |
7604 |
25 Feb 19 |
nicklas |
85 |
} |
7604 |
25 Feb 19 |
nicklas |
86 |
/* |
7604 |
25 Feb 19 |
nicklas |
alert(notify); |
7604 |
25 Feb 19 |
nicklas |
if (topWindow != window) |
7604 |
25 Feb 19 |
nicklas |
89 |
{ |
7604 |
25 Feb 19 |
nicklas |
alert(topWindow.exceptionHandlerCallback); |
7604 |
25 Feb 19 |
nicklas |
if (topWindow.exceptionHandlerCallback) |
7604 |
25 Feb 19 |
nicklas |
92 |
{ |
7604 |
25 Feb 19 |
nicklas |
topWindow.exceptionHandlerCallback(window.name); |
7604 |
25 Feb 19 |
nicklas |
94 |
} |
7604 |
25 Feb 19 |
nicklas |
95 |
} |
7604 |
25 Feb 19 |
nicklas |
96 |
*/ |
7604 |
25 Feb 19 |
nicklas |
97 |
} |
7604 |
25 Feb 19 |
nicklas |
98 |
|
7604 |
25 Feb 19 |
nicklas |
exception.goBack = function() |
7604 |
25 Feb 19 |
nicklas |
100 |
{ |
7604 |
25 Feb 19 |
nicklas |
history.go(-1); |
7604 |
25 Feb 19 |
nicklas |
102 |
} |
7604 |
25 Feb 19 |
nicklas |
103 |
|
7604 |
25 Feb 19 |
nicklas |
exception.reportBug = function(event) |
7604 |
25 Feb 19 |
nicklas |
105 |
{ |
7604 |
25 Feb 19 |
nicklas |
var reportLink = Data.get(event.currentTarget, 'report-link'); |
7604 |
25 Feb 19 |
nicklas |
if (reportLink) window.open(reportLink, 'ReportBug'); |
7604 |
25 Feb 19 |
nicklas |
108 |
} |
7604 |
25 Feb 19 |
nicklas |
109 |
|
7604 |
25 Feb 19 |
nicklas |
exception.goLogin = function() |
7604 |
25 Feb 19 |
nicklas |
111 |
{ |
7604 |
25 Feb 19 |
nicklas |
var url = App.getRoot()+'main.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&again=1' |
7604 |
25 Feb 19 |
nicklas |
Dialogs.openPopup(url, 'Login', 750, 450); |
7604 |
25 Feb 19 |
nicklas |
115 |
} |
7604 |
25 Feb 19 |
nicklas |
116 |
|
7604 |
25 Feb 19 |
nicklas |
exception.showMoreDetails = function(event) |
7604 |
25 Feb 19 |
nicklas |
118 |
{ |
7604 |
25 Feb 19 |
nicklas |
var id = Data.get(event.currentTarget, 'show-id'); |
7604 |
25 Feb 19 |
nicklas |
Doc.show(id); |
7604 |
25 Feb 19 |
nicklas |
Doc.hide(event.currentTarget); |
7604 |
25 Feb 19 |
nicklas |
122 |
} |
7604 |
25 Feb 19 |
nicklas |
123 |
|
7604 |
25 Feb 19 |
nicklas |
exception.continuePluginWizard = function() |
7604 |
25 Feb 19 |
nicklas |
125 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (confirm('Are you sure? Unsaved settings in the other wizard will be lost.')) |
7604 |
25 Feb 19 |
nicklas |
127 |
{ |
7604 |
25 Feb 19 |
nicklas |
location.replace(location.href + '&warnIfOpen=0'); |
7604 |
25 Feb 19 |
nicklas |
129 |
} |
7604 |
25 Feb 19 |
nicklas |
130 |
} |
7604 |
25 Feb 19 |
nicklas |
131 |
|
7604 |
25 Feb 19 |
nicklas |
132 |
|
7604 |
25 Feb 19 |
nicklas |
return exception; |
7604 |
25 Feb 19 |
nicklas |
134 |
}(); |
7604 |
25 Feb 19 |
nicklas |
135 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.onLoad(Exception.initPage); |
7604 |
25 Feb 19 |
nicklas |
137 |
|