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 Tree = function() |
7604 |
25 Feb 19 |
nicklas |
27 |
{ |
7604 |
25 Feb 19 |
nicklas |
var tree = {}; |
7604 |
25 Feb 19 |
nicklas |
29 |
|
7604 |
25 Feb 19 |
nicklas |
tree.initPage = function() |
7604 |
25 Feb 19 |
nicklas |
31 |
{ |
7604 |
25 Feb 19 |
nicklas |
IconStore.addDefaultIcons(); |
7604 |
25 Feb 19 |
nicklas |
33 |
|
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('Warning', 'warning.png', null, null, null, App.getRoot()+'images/'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('Error', 'error.png', null, null, null, App.getRoot()+'images/'); |
7604 |
25 Feb 19 |
nicklas |
36 |
|
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('ItemWarning', 'item-warning.png', 'item-warning-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('ItemError', 'item-error.png', 'item-error-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('ItemChildWarning', 'item-child-warning.png', 'item-child-warning-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('ItemChildError', 'item-child-error.png', 'item-child-error-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
41 |
|
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('FolderWarning', 'folder-warning.png', 'folder-warning-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('FolderError', 'folder-error.png', 'folder-error-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('FolderChildWarning', 'folder-child-warning.png', 'folder-child-warning-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('FolderChildError', 'folder-child-error.png', 'folder-child-error-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
46 |
|
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('Annotation', 'annotation.png', 'annotation-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('AnnotationWarning', 'annotation-warning.png', 'annotation-warning-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('AnnotationError', 'annotation-error.png', 'annotation-error-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('AnnotationChildWarning', 'annotation-child-warning.png', 'annotation-child-warning-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('AnnotationChildError', 'annotation-child-error.png', 'annotation-child-error-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
52 |
|
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('ProtocolParameter', 'parameter.png', 'parameter-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('ProtocolParameterWarning', 'parameter-warning.png', 'parameter-warning-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('ProtocolParameterError', 'parameter-error.png', 'parameter-error-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('ProtocolParameterChildWarning', 'parameter-child-warning.png', 'parameter-child-warning-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
IconStore.addIconSet('ProtocolParameterChildError', 'parameter-child-error.png', 'parameter-child-error-selected.png'); |
7604 |
25 Feb 19 |
nicklas |
58 |
|
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('joust', 'joust-select', tree.onSelect); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('joust', 'joust-lazy-init', tree.lazyInit); |
7604 |
25 Feb 19 |
nicklas |
61 |
|
7604 |
25 Feb 19 |
nicklas |
Joust2.draw('joust'); |
7604 |
25 Feb 19 |
nicklas |
63 |
} |
7604 |
25 Feb 19 |
nicklas |
64 |
|
7604 |
25 Feb 19 |
nicklas |
tree.onSelect = function(event) |
7604 |
25 Feb 19 |
nicklas |
66 |
{ |
7604 |
25 Feb 19 |
nicklas |
var url = 'info.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&nodeId='+event.target.id; |
7604 |
25 Feb 19 |
nicklas |
url += '&show_failures='+Data.get('page-data', 'show-failures'); |
7604 |
25 Feb 19 |
nicklas |
parent.frames['info'].location.href = url; |
7604 |
25 Feb 19 |
nicklas |
71 |
} |
7604 |
25 Feb 19 |
nicklas |
72 |
|
7604 |
25 Feb 19 |
nicklas |
tree.selectNode = function(nodeId) |
7604 |
25 Feb 19 |
nicklas |
74 |
{ |
7604 |
25 Feb 19 |
nicklas |
Joust2.select(nodeId); |
7604 |
25 Feb 19 |
nicklas |
76 |
} |
7604 |
25 Feb 19 |
nicklas |
77 |
|
7604 |
25 Feb 19 |
nicklas |
tree.lazyInit = function(event) |
7604 |
25 Feb 19 |
nicklas |
79 |
{ |
7604 |
25 Feb 19 |
nicklas |
var menuElement = event.target; |
7604 |
25 Feb 19 |
nicklas |
Doc.addClass(menuElement, 'working'); |
7604 |
25 Feb 19 |
nicklas |
try |
7604 |
25 Feb 19 |
nicklas |
83 |
{ |
7604 |
25 Feb 19 |
nicklas |
var request = Ajax.getXmlHttpRequest(); |
7604 |
25 Feb 19 |
nicklas |
var url = 'ajax.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&cmd=GetSubNodes&node_id=' + menuElement.id; |
7604 |
25 Feb 19 |
nicklas |
request.open("GET", url, false); |
7604 |
25 Feb 19 |
nicklas |
request.send(null); |
7604 |
25 Feb 19 |
nicklas |
89 |
|
7604 |
25 Feb 19 |
nicklas |
var response = JSON.parse(request.responseText); |
7604 |
25 Feb 19 |
nicklas |
if (response.status != 'ok') |
7604 |
25 Feb 19 |
nicklas |
92 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(menuElement.id+'-outline', response.message); |
7604 |
25 Feb 19 |
nicklas |
94 |
} |
7604 |
25 Feb 19 |
nicklas |
95 |
|
7604 |
25 Feb 19 |
nicklas |
Joust2.addChildren(menuElement, response.childNodes || []); |
7604 |
25 Feb 19 |
nicklas |
Joust2.toggle(menuElement); |
7604 |
25 Feb 19 |
nicklas |
98 |
} |
7604 |
25 Feb 19 |
nicklas |
finally |
7604 |
25 Feb 19 |
nicklas |
100 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.removeClass(menuElement, 'working'); |
7604 |
25 Feb 19 |
nicklas |
102 |
} |
7604 |
25 Feb 19 |
nicklas |
103 |
} |
7604 |
25 Feb 19 |
nicklas |
104 |
|
7604 |
25 Feb 19 |
nicklas |
return tree; |
7604 |
25 Feb 19 |
nicklas |
106 |
}(); |
7604 |
25 Feb 19 |
nicklas |
107 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.onLoad(Tree.initPage); |
7604 |
25 Feb 19 |
nicklas |
109 |
|
7604 |
25 Feb 19 |
nicklas |
110 |
|