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 History = function() |
7604 |
25 Feb 19 |
nicklas |
27 |
{ |
7604 |
25 Feb 19 |
nicklas |
var history = {}; |
7604 |
25 Feb 19 |
nicklas |
var loaded = false; |
7604 |
25 Feb 19 |
nicklas |
30 |
|
7604 |
25 Feb 19 |
nicklas |
31 |
/** |
7604 |
25 Feb 19 |
nicklas |
Initialize the page. |
7604 |
25 Feb 19 |
nicklas |
33 |
*/ |
7604 |
25 Feb 19 |
nicklas |
history.initPage = function() |
7604 |
25 Feb 19 |
nicklas |
35 |
{ |
7604 |
25 Feb 19 |
nicklas |
var pageId = Doc.getPageId(); |
7604 |
25 Feb 19 |
nicklas |
if (pageId == 'view-history') |
7604 |
25 Feb 19 |
nicklas |
38 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Buttons |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
41 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (pageId == 'list-history') |
7604 |
25 Feb 19 |
nicklas |
43 |
{ |
7604 |
25 Feb 19 |
nicklas |
var attributes = {'item-type': 'CHANGEHISTORY'}; |
7604 |
25 Feb 19 |
nicklas |
var tableAttributes = {'table-id': 'history'}; |
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 |
48 |
|
7604 |
25 Feb 19 |
nicklas |
49 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
51 |
{ |
7604 |
25 Feb 19 |
nicklas |
// Iframe included on single-item view page of other items |
7604 |
25 Feb 19 |
nicklas |
53 |
} |
7604 |
25 Feb 19 |
nicklas |
54 |
} |
7604 |
25 Feb 19 |
nicklas |
55 |
|
7604 |
25 Feb 19 |
nicklas |
history.loadOnce = function() |
7604 |
25 Feb 19 |
nicklas |
57 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (loaded) return; |
7604 |
25 Feb 19 |
nicklas |
var url = App.getRoot() + 'common/history/index.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=List'; |
7604 |
25 Feb 19 |
nicklas |
url += '&source_type='+Data.get('history-data', 'source-type'); |
7604 |
25 Feb 19 |
nicklas |
url += '&source_id='+Data.get('history-data', 'source-id'); |
7952 |
12 May 21 |
nicklas |
url += '&transact_id='+Data.get('history-data', 'transact-id'); |
7604 |
25 Feb 19 |
nicklas |
frames['history-frame'].location.replace(url); |
7604 |
25 Feb 19 |
nicklas |
loaded = true; |
7604 |
25 Feb 19 |
nicklas |
66 |
} |
7604 |
25 Feb 19 |
nicklas |
67 |
|
7949 |
10 May 21 |
nicklas |
history.initElements = function(element, autoInit) |
7949 |
10 May 21 |
nicklas |
69 |
{ |
7952 |
12 May 21 |
nicklas |
if (autoInit == 'transact-box') |
7952 |
12 May 21 |
nicklas |
71 |
{ |
7952 |
12 May 21 |
nicklas |
Events.addEventHandler(element, 'mouseenter', history.mouseEnterTransactBox); |
7952 |
12 May 21 |
nicklas |
Events.addEventHandler(element, 'mouseleave', history.mouseLeaveTransactBox); |
7952 |
12 May 21 |
nicklas |
74 |
} |
7952 |
12 May 21 |
nicklas |
else if (autoInit == 'transact-link') |
7952 |
12 May 21 |
nicklas |
76 |
{ |
7952 |
12 May 21 |
nicklas |
Events.addEventHandler(element, 'click', history.viewTransaction); |
7952 |
12 May 21 |
nicklas |
78 |
} |
7949 |
10 May 21 |
nicklas |
79 |
} |
7949 |
10 May 21 |
nicklas |
80 |
|
7952 |
12 May 21 |
nicklas |
history.viewTransaction = function(event) |
7952 |
12 May 21 |
nicklas |
82 |
{ |
7952 |
12 May 21 |
nicklas |
var url = App.getRoot()+Items.getController('SESSION').url + '?ID='+App.getSessionId(); |
7952 |
12 May 21 |
nicklas |
url += '&cmd=ViewTransaction&item_id='+Data.get(event.currentTarget, 'session-id'); |
7952 |
12 May 21 |
nicklas |
url += '&transact_id='+Data.get(event.currentTarget, 'transact-id'); |
7952 |
12 May 21 |
nicklas |
window.parent.location.href = url; |
7952 |
12 May 21 |
nicklas |
87 |
} |
7952 |
12 May 21 |
nicklas |
88 |
|
7949 |
10 May 21 |
nicklas |
history.mouseEnterTransactBox = function(event) |
7949 |
10 May 21 |
nicklas |
90 |
{ |
7949 |
10 May 21 |
nicklas |
Doc.addClass('history', 'transact-'+Data.get(event.currentTarget, 'transact-id')); |
7949 |
10 May 21 |
nicklas |
92 |
} |
7949 |
10 May 21 |
nicklas |
93 |
|
7949 |
10 May 21 |
nicklas |
history.mouseLeaveTransactBox = function(event) |
7949 |
10 May 21 |
nicklas |
95 |
{ |
7949 |
10 May 21 |
nicklas |
Doc.removeClass('history', 'transact-'+Data.get(event.currentTarget, 'transact-id')); |
7949 |
10 May 21 |
nicklas |
97 |
} |
7949 |
10 May 21 |
nicklas |
98 |
|
7604 |
25 Feb 19 |
nicklas |
return history; |
7604 |
25 Feb 19 |
nicklas |
100 |
}(); |
7949 |
10 May 21 |
nicklas |
Doc.addElementInitializer(History.initElements); |
6181 |
22 Oct 12 |
nicklas |
Doc.onLoad(History.initPage); |