-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemoFuncsMenu.html
executable file
·137 lines (114 loc) · 5.63 KB
/
demoFuncsMenu.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<HTML>
<!--------------------------------------------------------------->
<!-- Copyright (c) 2006 by Conor O'Mahony. -->
<!-- For enquiries, please email GubuSoft@GubuSoft.com. -->
<!-- Please keep all copyright notices below. -->
<!-- Original author of TreeView script is Marcelino Martins. -->
<!--------------------------------------------------------------->
<!-- This document includes the TreeView script. The TreeView -->
<!-- script can be found at http://www.TreeView.net. The -->
<!-- script is Copyright (c) 2006 by Conor O'Mahony. -->
<!--------------------------------------------------------------->
<HEAD>
<TITLE>TreeView Demo: JavaScript Functions</TITLE>
<style>
BODY {
background-color: white;
font-size: 10pt;
font-family: verdana,helvetica;}
.menuBtn {
width:100%;}
</style>
<script>
// The JavaScript for the buttons at the bottom of the left-hand frame follows.
// These functions expand all nodes in the tree, collapse all nodes in the tree,
// open a specific node in the tree, or load a particular document in the
// right-hand frame.
//
// The buttons in this demo are in a separate frame both from the actual tree
// and from the actual content. If you want to include the buttons in the same
// frame as the tree, or in the same frame as the documents, move these
// functions to the appropriate file. For example, in the case of this example,
// if you want to display the buttons on the same frame as the tree, move these
// functions to the demoFuncs.html file. If you move these functions, you must
// update the DOM paths used to access the functions and used by the functions
// themselves.
// The expandTree function expands all children nodes for the specified node.
// The specified node must be a folder node.
// When the specified node is the root node, this function opens all nodes in
// the tree. When the specified is not the root node, only the children of the
// specified node are opened.
// Note that for some very large trees, the browser may time out when this
// function is used.
function expandTree(folderObj) {
var childObj;
var i;
// Open the folder
if (!folderObj.isOpen)
parent.treeframe.clickOnNodeObj(folderObj)
// Call this function for all children
for (i=0 ; i < folderObj.nChildren; i++) {
childObj = folderObj.children[i]
if (typeof childObj.setState != "undefined") { // If this is a folder
expandTree(childObj)
}
}
}
// The collapseTree function closes all nodes in the tree.
function collapseTree() {
// Close all folder nodes
parent.treeframe.clickOnNodeObj(parent.treeframe.foldersTree)
// Restore the tree to the top level
parent.treeframe.clickOnNodeObj(parent.treeframe.foldersTree)
}
// The openFolderInTree function open all children nodes of the specified
// node. Note that in order to open a folder, we need to open the parent
// folders all the way to the root. (Of course, this does not affect
// selection highlight.)
function openFolderInTree(linkID) {
var folderObj;
folderObj = parent.treeframe.findObj(linkID);
folderObj.forceOpeningOfAncestorFolders();
if (!folderObj.isOpen)
parent.treeframe.clickOnNodeObj(folderObj);
}
// The loadSynchPage function load the appropriate document, as if
// the specified node on the tree was clicked. This function also
// synchronizes the frames and highlights the selection (if highlight
// is enabled).
function loadSynchPage(linkID) {
var folderObj;
docObj = parent.treeframe.findObj(linkID);
docObj.forceOpeningOfAncestorFolders();
parent.treeframe.clickOnLink(linkID,docObj.link,'basefrm');
// Scroll the tree to show the selected node.
// For this function to work with frameless pages, you will need to
// remove the following code and also probably change other code in
// these functions.
if (typeof parent.treeframe.document.body != "undefined") // To handle scrolling not working with NS4
parent.treeframe.document.body.scrollTop=docObj.navObj.offsetTop
}
</script>
</HEAD>
<BODY BGCOLOR="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<center>
<form>
<input type="button" onClick="javascript:expandTree(parent.treeframe.foldersTree)" value="Open All" class="menuBtn">
<!----------------------------------------------------------->
<!-- The next three function calls have hardcoded values -->
<!-- that specify the id of a node in the tree. To figure -->
<!-- out the node ids that you might want to use, you can: -->
<!-- - Use node.xID (which may be a string). -->
<!-- - Open the tree in a browser, move your mouse over -->
<!-- the +/- nodes to the left of the folder names. -->
<!-- The node ids are shown in the star=tus bar. -->
<!-- Increment the numbers sequentially to get the node -->
<!-- ids of the "documents" inside that folder. -->
<!----------------------------------------------------------->
<input type="button" onClick="javascript:collapseTree(1)" value="Close All" class="menuBtn">
<input type="button" onClick="javascript:openFolderInTree(1)" value="Open Flags Folder" class="menuBtn">
<input type="button" onClick="javascript:loadSynchPage(10)" value="Load Map of Europe" class="menuBtn">
</form>
</center>
</BODY>
</HTML>