File: sectionTabs.js.php

package info (click to toggle)
gallery 1.5-1sarge2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 21,172 kB
  • ctags: 4,516
  • sloc: php: 26,456; sh: 427; perl: 188; makefile: 58; xml: 48
file content (57 lines) | stat: -rw-r--r-- 1,467 bytes parent folder | download
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
<?php

function insertSectionToggle() {
?>

<!-- This Javascript and the Tabs are inspired by the Horde Forms code -->

        function configSection(inittab) {

                this.toggle = function(id) {
                        document.getElementById(this.oldtab).style.display 	= 'none';
                        document.getElementById('tab_' + this.oldtab).className = 'tab';
                         document.getElementById(id).style.display 		= 'inline';
                        document.getElementById('tab_' + id).className 		= 'tab-hi';

                        this.oldtab=id;
			this.currentSectionNr= this.getTabByName(id);
                }

		this.getTabByNr = function(nr) {
			for (var itemNr=0; itemNr <= Sections.length; itemNr++) {
				if (Sections[itemNr] == Sections[nr]) {
					return (Sections[itemNr]);
				}
			}
		}

		this.getTabByName = function(name) {
			for (var itemNr=0; itemNr <= Sections.length; itemNr++) {
				if (Sections[itemNr] == name) {
					return (itemNr);
				}
			}
		}

		this.nextTab = function() {
			if (this.currentSectionNr < Sections.length-1) {
				nextTab=this.getTabByNr(this.currentSectionNr+1);
				this.toggle(nextTab);
			}
		}

		this.prevTab = function() {
			if (this.currentSectionNr >0) {
				prevTab=this.getTabByNr(this.currentSectionNr-1);
				this.toggle(prevTab);
			}
		}

		// Init Values

                this.oldtab=inittab;
		this.currentSectionNr= this.getTabByName(inittab);

	}
<?php
}