Project

General

Profile

« Previous | Next » 

Revision 8ed6b8e3

Added by Stephen Beaver over 9 years ago

Relocated tree directory to vendors/tree

View differences:

src/etc/pfSense.obsoletedfiles
870 870
/usr/local/www/system_usermanager_settings_test.php
871 871
/usr/local/www/themes
872 872
/usr/local/www/ticker.js
873
/usr/local/www/tree/i-bottom.gif
874
/usr/local/www/tree/i-repeater.gif
875
/usr/local/www/tree/l.gif
876
/usr/local/www/tree/minus.gif
877
/usr/local/www/tree/page-file.png
878
/usr/local/www/tree/page-file_play.gif
879
/usr/local/www/tree/page-file_x.gif
880
/usr/local/www/tree/page-foldericon.png
881
/usr/local/www/tree/page-openfoldericon.png
882
/usr/local/www/tree/plus.gif
883
/usr/local/www/tree/t.gif
884
/usr/local/www/tree/tree.js
873 885
/usr/local/www/tree-images
874 886
/usr/local/www/treeview.css
875 887
/usr/local/www/upload_progress.php
src/usr/local/www/css/pfSense.css
43 43
    text-decoration: none !important;
44 44
}
45 45

  
46
h1 a:hover, h1 a:active { 
47
    color: #000000; 
48
    text-decoration: none !important; 
46
h1 a:hover, h1 a:active {
47
    color: #000000;
48
    text-decoration: none !important;
49 49
}
50 50

  
51 51
.container.fixed {
......
624 624

  
625 625
ul.tree li {
626 626
    list-style: none;
627
    background: url(../../tree/i-repeater.gif) 0 0 repeat-y;
627
    background: url(../../vendor/tree/i-repeater.gif) 0 0 repeat-y;
628 628
    display: block;
629 629
    width: auto;
630 630
}
......
636 636

  
637 637
/* Span-A: I/L/I glpyhs */
638 638
ul.tree span.a {
639
    background: url(../../tree/t.gif) 0 50% no-repeat;
639
    background: url(../../vendor/tree/t.gif) 0 50% no-repeat;
640 640
    display: block;
641 641
}
642 642

  
643 643
ul.tree span.a.last {
644
    background: url(../../tree/l.gif) 0 50% no-repeat;
644
    background: url(../../vendor/tree/l.gif) 0 50% no-repeat;
645 645
}
646 646

  
647 647
/* Span-B: Plus/Minus icon */
......
650 650
}
651 651

  
652 652
ul.tree span.a.children span.b {
653
    background: url(../../tree/minus.gif) 0 50% no-repeat;
653
    background: url(../../vendor/tree/minus.gif) 0 50% no-repeat;
654 654
    cursor: pointer;
655 655
}
656 656

  
657 657
ul.tree li.closed span.a.children span.b {
658
    background: url(../../tree/plus.gif) 0 50% no-repeat;
658
    background: url(../../vendor/tree/plus.gif) 0 50% no-repeat;
659 659
    cursor: pointer;
660 660
}
661 661

  
......
665 665
}
666 666

  
667 667
ul.tree span.a.children span.c {
668
    background: url(../../tree/i-bottom.gif) 0 50% no-repeat;
668
    background: url(../../vendor/tree/i-bottom.gif) 0 50% no-repeat;
669 669
}
670 670

  
671 671
ul.tree span.a.spanClosed span.c {
......
678 678
    overflow: hidden;
679 679
    padding: 3px 0px 3px 18px;
680 680
    line-height: 16px;
681
    background: url(../../tree/page-file.png) 0 0 no-repeat;
681
    background: url(../../vendor/tree/page-file.png) 0 0 no-repeat;
682 682
}
683 683

  
684 684
ul.tree span.a.children a {
685
    background-image: url(../../tree/page-openfoldericon.png);
685
    background-image: url(../../vendor/tree/page-openfoldericon.png);
686 686
}
687 687

  
688 688
ul.tree span.a.children.spanClosed a {
689
    background-image: url(../../tree/page-foldericon.png);
689
    background-image: url(../../vendor/tree/page-foldericon.png);
690 690
}
691 691

  
692 692
/* Unformatted tree */
src/usr/local/www/firewall_shaper.php
440 440
display_top_tabs($tab_array);
441 441

  
442 442
?>
443
<script type="text/javascript" src="./tree/tree.js"></script>
443
<script type="text/javascript" src="./vendor/tree/tree.js"></script>
444 444

  
445 445
<div class="table-responsive">
446 446
	<table class="table">
src/usr/local/www/firewall_shaper_queues.php
224 224
include("head.inc");
225 225
?>
226 226

  
227
<script type="text/javascript" src="./tree/tree.js"></script>
227
<script type="text/javascript" src="./vendor/tree/tree.js"></script>
228 228

  
229 229
<?php
230 230
if ($input_errors) {
src/usr/local/www/firewall_shaper_vinterface.php
377 377
$output .= $output_form;
378 378
include("head.inc");
379 379
?>
380
<script type="text/javascript" src="./tree/tree.js"></script>
380
<script type="text/javascript" src="./vendor/tree/tree.js"></script>
381 381

  
382 382
<script type="text/javascript">
383 383
//<![CDATA[
src/usr/local/www/tree/tree.js
1
/*
2
 * Content-separated javascript tree widget
3
 * Copyright (C) 2005 SilverStripe Limited
4
 * Feel free to use this on your websites, but please leave this message in the fies
5
 * http://www.silverstripe.com/blog
6
*/
7

  
8
/*
9
 * Initialise all trees identified by <ul class="tree">
10
 */
11
function autoInit_trees() {
12
	var candidates = document.getElementsByTagName('ul');
13
	for(var i=0;i<candidates.length;i++) {
14
		if(candidates[i].className && candidates[i].className.indexOf('tree') != -1) {
15
			initTree(candidates[i]);
16
			candidates[i].className = candidates[i].className.replace(/ ?unformatted ?/, ' ');
17
		}
18
	}
19
}
20
 
21
/*
22
 * Initialise a tree node, converting all its LIs appropriately
23
 */
24
function initTree(el) {
25
	var i,j;
26
	var spanA, spanB, spanC;
27
	var startingPoint, stoppingPoint, childUL;
28
	
29
	// Find all LIs to process
30
	for(i=0;i<el.childNodes.length;i++) {
31
		if(el.childNodes[i].tagName && el.childNodes[i].tagName.toLowerCase() == 'li') {
32
			var li = el.childNodes[i];
33

  
34
			// Create our extra spans
35
			spanA = document.createElement('span');
36
			spanB = document.createElement('span');
37
			spanC = document.createElement('span');
38
			spanA.appendChild(spanB);
39
			spanB.appendChild(spanC);
40
			spanA.className = 'a ' + li.className.replace('closed','spanClosed');
41
			spanA.onMouseOver = function() {};
42
			spanB.className = 'b';
43
			spanB.onclick = treeToggle;
44
			spanC.className = 'c';
45
			
46
			
47
			// Find the UL within the LI, if it exists
48
			stoppingPoint = li.childNodes.length;
49
			startingPoint = 0;
50
			childUL = null;
51
			for(j=0;j<li.childNodes.length;j++) {
52
				if(li.childNodes[j].tagName && li.childNodes[j].tagName.toLowerCase() == 'div') {
53
					startingPoint = j + 1;
54
					continue;
55
				}
56

  
57
				if(li.childNodes[j].tagName && li.childNodes[j].tagName.toLowerCase() == 'ul') {
58
					childUL = li.childNodes[j];
59
					stoppingPoint = j;
60
					break;					
61
				}
62
			}
63
				
64
			// Move all the nodes up until that point into spanC
65
			for(j=startingPoint;j<stoppingPoint;j++) {
66
				spanC.appendChild(li.childNodes[startingPoint]);
67
			}
68
			
69
			// Insert the outermost extra span into the tree
70
			if(li.childNodes.length > startingPoint) li.insertBefore(spanA, li.childNodes[startingPoint]);
71
			else li.appendChild(spanA);
72
			
73
			// Process the children
74
			if(childUL != null) {
75
				if(initTree(childUL)) {
76
					addClass(li, 'children', 'closed');
77
					addClass(spanA, 'children', 'spanClosed');
78
				}
79
			}
80
		}
81
	}
82
	
83
	if(li) {
84
		// li and spanA will still be set to the last item
85

  
86
		addClass(li, 'last', 'closed');
87
		addClass(spanA, 'last', 'spanClosed');
88
		return true;
89
	} else {
90
		return false;
91
	}
92
		
93
}
94
 
95

  
96
/*
97
 * +/- toggle the tree, where el is the <span class="b"> node
98
 * force, will force it to "open" or "close"
99
 */
100
function treeToggle(el, force) {
101
	el = this;
102
	
103
	while(el != null && (!el.tagName || el.tagName.toLowerCase() != "li")) el = el.parentNode;
104
	
105
	// Get UL within the LI
106
	var childSet = findChildWithTag(el, 'ul');
107
	var topSpan = findChildWithTag(el, 'span');
108

  
109
	if( force != null ){
110
		
111
		if( force == "open"){
112
			treeOpen( topSpan, el );
113
		}
114
		else if( force == "close" ){
115
			treeClose( topSpan, el );
116
		}
117
		
118
	}
119
	
120
	else if( childSet != null) {
121
		// Is open, close it
122
		if(!el.className.match(/(^| )closed($| )/)) {		
123
			treeClose( topSpan, el );
124
		// Is closed, open it
125
		} else {			
126
			treeOpen( topSpan, el );
127
		}
128
	}
129
}
130

  
131

  
132
function treeOpen( a, b ){
133
	removeClass(a,'spanClosed');
134
	removeClass(b,'closed');
135
}
136
	
137
	
138
function treeClose( a, b ){
139
	addClass(a,'spanClosed');
140
	addClass(b,'closed');
141
}
142

  
143
/*
144
 * Find the a child of el of type tag
145
 */
146
function findChildWithTag(el, tag) {
147
	for(var i=0;i<el.childNodes.length;i++) {
148
		if(el.childNodes[i].tagName != null && el.childNodes[i].tagName.toLowerCase() == tag) return el.childNodes[i];
149
	}
150
	return null;
151
}
152

  
153
/*
154
 * Functions to add and remove class names
155
 * Mac IE hates unnecessary spaces
156
 */
157
function addClass(el, cls, forceBefore) {
158
	if(forceBefore != null && el.className.match(new RegExp('(^| )' + forceBefore))) {
159
		el.className = el.className.replace(new RegExp("( |^)" + forceBefore), '$1' + cls + ' ' + forceBefore);
160

  
161
	} else if(!el.className.match(new RegExp('(^| )' + cls + '($| )'))) {
162
		el.className += ' ' + cls;
163
		el.className = el.className.replace(/(^ +)|( +$)/g, '');
164
	}
165
}
166
function removeClass(el, cls) {
167
	var old = el.className;
168
	var newCls = ' ' + el.className + ' ';
169
	newCls = newCls.replace(new RegExp(' (' + cls + ' +)+','g'), ' ');
170
	el.className = newCls.replace(/(^ +)|( +$)/g, '');
171
} 
172

  
173
/*
174
 * Handlers for automated loading
175
 */ 
176
 _LOADERS = Array();
177

  
178
function callAllLoaders() {
179
	var i, loaderFunc;
180
	for(i=0;i<_LOADERS.length;i++) {
181
		loaderFunc = _LOADERS[i];
182
		if(loaderFunc != callAllLoaders) loaderFunc();
183
	}
184
}
185

  
186
function appendLoader(loaderFunc) {
187
	if(window.onload && window.onload != callAllLoaders)
188
		_LOADERS[_LOADERS.length] = window.onload;
189

  
190
	window.onload = callAllLoaders;
191

  
192
	_LOADERS[_LOADERS.length] = loaderFunc;
193
}
194

  
195
appendLoader(autoInit_trees);
src/usr/local/www/vendor/tree/tree.js
1
/*
2
 * Content-separated javascript tree widget
3
 * Copyright (C) 2005 SilverStripe Limited
4
 * Feel free to use this on your websites, but please leave this message in the fies
5
 * http://www.silverstripe.com/blog
6
*/
7

  
8
/*
9
 * Initialise all trees identified by <ul class="tree">
10
 */
11
function autoInit_trees() {
12
	var candidates = document.getElementsByTagName('ul');
13
	for(var i=0;i<candidates.length;i++) {
14
		if(candidates[i].className && candidates[i].className.indexOf('tree') != -1) {
15
			initTree(candidates[i]);
16
			candidates[i].className = candidates[i].className.replace(/ ?unformatted ?/, ' ');
17
		}
18
	}
19
}
20
 
21
/*
22
 * Initialise a tree node, converting all its LIs appropriately
23
 */
24
function initTree(el) {
25
	var i,j;
26
	var spanA, spanB, spanC;
27
	var startingPoint, stoppingPoint, childUL;
28
	
29
	// Find all LIs to process
30
	for(i=0;i<el.childNodes.length;i++) {
31
		if(el.childNodes[i].tagName && el.childNodes[i].tagName.toLowerCase() == 'li') {
32
			var li = el.childNodes[i];
33

  
34
			// Create our extra spans
35
			spanA = document.createElement('span');
36
			spanB = document.createElement('span');
37
			spanC = document.createElement('span');
38
			spanA.appendChild(spanB);
39
			spanB.appendChild(spanC);
40
			spanA.className = 'a ' + li.className.replace('closed','spanClosed');
41
			spanA.onMouseOver = function() {};
42
			spanB.className = 'b';
43
			spanB.onclick = treeToggle;
44
			spanC.className = 'c';
45
			
46
			
47
			// Find the UL within the LI, if it exists
48
			stoppingPoint = li.childNodes.length;
49
			startingPoint = 0;
50
			childUL = null;
51
			for(j=0;j<li.childNodes.length;j++) {
52
				if(li.childNodes[j].tagName && li.childNodes[j].tagName.toLowerCase() == 'div') {
53
					startingPoint = j + 1;
54
					continue;
55
				}
56

  
57
				if(li.childNodes[j].tagName && li.childNodes[j].tagName.toLowerCase() == 'ul') {
58
					childUL = li.childNodes[j];
59
					stoppingPoint = j;
60
					break;					
61
				}
62
			}
63
				
64
			// Move all the nodes up until that point into spanC
65
			for(j=startingPoint;j<stoppingPoint;j++) {
66
				spanC.appendChild(li.childNodes[startingPoint]);
67
			}
68
			
69
			// Insert the outermost extra span into the tree
70
			if(li.childNodes.length > startingPoint) li.insertBefore(spanA, li.childNodes[startingPoint]);
71
			else li.appendChild(spanA);
72
			
73
			// Process the children
74
			if(childUL != null) {
75
				if(initTree(childUL)) {
76
					addClass(li, 'children', 'closed');
77
					addClass(spanA, 'children', 'spanClosed');
78
				}
79
			}
80
		}
81
	}
82
	
83
	if(li) {
84
		// li and spanA will still be set to the last item
85

  
86
		addClass(li, 'last', 'closed');
87
		addClass(spanA, 'last', 'spanClosed');
88
		return true;
89
	} else {
90
		return false;
91
	}
92
		
93
}
94
 
95

  
96
/*
97
 * +/- toggle the tree, where el is the <span class="b"> node
98
 * force, will force it to "open" or "close"
99
 */
100
function treeToggle(el, force) {
101
	el = this;
102
	
103
	while(el != null && (!el.tagName || el.tagName.toLowerCase() != "li")) el = el.parentNode;
104
	
105
	// Get UL within the LI
106
	var childSet = findChildWithTag(el, 'ul');
107
	var topSpan = findChildWithTag(el, 'span');
108

  
109
	if( force != null ){
110
		
111
		if( force == "open"){
112
			treeOpen( topSpan, el );
113
		}
114
		else if( force == "close" ){
115
			treeClose( topSpan, el );
116
		}
117
		
118
	}
119
	
120
	else if( childSet != null) {
121
		// Is open, close it
122
		if(!el.className.match(/(^| )closed($| )/)) {		
123
			treeClose( topSpan, el );
124
		// Is closed, open it
125
		} else {			
126
			treeOpen( topSpan, el );
127
		}
128
	}
129
}
130

  
131

  
132
function treeOpen( a, b ){
133
	removeClass(a,'spanClosed');
134
	removeClass(b,'closed');
135
}
136
	
137
	
138
function treeClose( a, b ){
139
	addClass(a,'spanClosed');
140
	addClass(b,'closed');
141
}
142

  
143
/*
144
 * Find the a child of el of type tag
145
 */
146
function findChildWithTag(el, tag) {
147
	for(var i=0;i<el.childNodes.length;i++) {
148
		if(el.childNodes[i].tagName != null && el.childNodes[i].tagName.toLowerCase() == tag) return el.childNodes[i];
149
	}
150
	return null;
151
}
152

  
153
/*
154
 * Functions to add and remove class names
155
 * Mac IE hates unnecessary spaces
156
 */
157
function addClass(el, cls, forceBefore) {
158
	if(forceBefore != null && el.className.match(new RegExp('(^| )' + forceBefore))) {
159
		el.className = el.className.replace(new RegExp("( |^)" + forceBefore), '$1' + cls + ' ' + forceBefore);
160

  
161
	} else if(!el.className.match(new RegExp('(^| )' + cls + '($| )'))) {
162
		el.className += ' ' + cls;
163
		el.className = el.className.replace(/(^ +)|( +$)/g, '');
164
	}
165
}
166
function removeClass(el, cls) {
167
	var old = el.className;
168
	var newCls = ' ' + el.className + ' ';
169
	newCls = newCls.replace(new RegExp(' (' + cls + ' +)+','g'), ' ');
170
	el.className = newCls.replace(/(^ +)|( +$)/g, '');
171
} 
172

  
173
/*
174
 * Handlers for automated loading
175
 */ 
176
 _LOADERS = Array();
177

  
178
function callAllLoaders() {
179
	var i, loaderFunc;
180
	for(i=0;i<_LOADERS.length;i++) {
181
		loaderFunc = _LOADERS[i];
182
		if(loaderFunc != callAllLoaders) loaderFunc();
183
	}
184
}
185

  
186
function appendLoader(loaderFunc) {
187
	if(window.onload && window.onload != callAllLoaders)
188
		_LOADERS[_LOADERS.length] = window.onload;
189

  
190
	window.onload = callAllLoaders;
191

  
192
	_LOADERS[_LOADERS.length] = loaderFunc;
193
}
194

  
195
appendLoader(autoInit_trees);

Also available in: Unified diff