summaryrefslogtreecommitdiffstats
path: root/public/media/js/script.js
blob: 324255df773da9a0595afc167b6eb0b7ec0d2ac1 (plain) (blame)
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
$(document)
		.ready(
				function() {
					if ($('.listelement .element').find('.dispnone').length >= 1) {
						$('.listelement .element')
								.find('.dispnone')
								.parent()
								.find('.title')
								.css('cursor', 'pointer')
								.prepend(
										"<span class='toggler'><img src='/media/img/right.png'></span> ")
								.data('toggle', '0');

						$('.listelement .title').click(
								function() {
									$(this).siblings('.dispnone').toggle();
									if ($(this).data('toggle') == '0') {
										$(this).data('toggle', '1');
										$(this).find('.toggler img').attr(
												'src', '/media/img/down.png')
									} else {
										$(this).data('toggle', '0');
										$(this).find('.toggler img').attr(
												'src', '/media/img/right.png')
									}
								});
					}
					$('.helpericon').click(
							function() {
								$('.infobox').slideToggle('fast');
								if ($(this).data('info') == '1') {
									$(this).data('info', '0').attr('src',
											'/media/img/bulb_off.png');
								} else {
									$(this).data('info', '1').attr('src',
											'/media/img/bulb_on.png');
								}
							});
					path = window.location.pathname.split('/');
					if (path[2] == 'person'
							&& (path[3] == 'owndetails' || path[3] == 'edit' || path[3] == 'request')
							&& path[4] != 'personID') {
						mypath = '/' + path[1] + '/' + path[2] + '/owndetails';
					} else if (path[2] == 'group'
							&& (path[3] == 'show' || path[3] == 'edit')
							&& path[4] != 'groupID') {
						mypath = '/' + path[1] + '/' + path[2] + '/show';
					} else {
						mypath = '/' + path[1] + '/' + path[2];
					}
					$('.portletNavigationTree a').each(function() {
						if ($(this).attr('href') == mypath) {
							/* console.log($(this).parent()); */
							$(this).addClass('navTreeCurrentNode');
							$(this).addClass('navTreeCurrentItem');
						}
					});
				});

function checkAllCheckBoxes(exceptions) {
	$('input:checkbox').attr('checked', 'checked');
	return;
}

function uncheckAllCheckBoxes(exceptions) {
	$('input:checkbox').attr('checked', '');
	return;
}

function setVisible(name) {
	hidden = document.getElementById(name);
	if (hidden) {
		hidden.style.display = "";
	}
}

function setInvisible(name) {
	visible = document.getElementById(name);
	if (visible) {
		visible.style.display = "none";
	}
}

function eventcategoryfieldChanged(name) {
	field = document.getElementById(name);
	value = field.value;
	options = field.options;
	for (i = 0; i < options.length; i++) {
		option = options[i];
		if (option.value == field.value) {
			break;
		}
	}
	label = option.label;
	endLabel = document.getElementById('end-label');
	endElement = document.getElementById('end-element');
	startLabel = document.getElementById('start-label');
	repeat = document.getElementById('repeat');
	if (label == 'Boot' || label == 'Shutdown') {
		endLabel.style.display = "none";
		endElement.style.display = "none";
		startLabel.firstChild.firstChild.nodeValue = startLabel.firstChild.firstChild.nodeValue
				.replace(/Start/g, "Date");
		repeat.checked = false;
	} else if (label == 'Lecture') {
		endLabel.style.display = "";
		endElement.style.display = "";
		startLabel.firstChild.firstChild.nodeValue = startLabel.firstChild.firstChild.nodeValue
				.replace(/Date/g, "Start");
		repeat.checked = true;
	} else {
		endLabel.style.display = "";
		endElement.style.display = "";
		startLabel.firstChild.firstChild.nodeValue = startLabel.firstChild.firstChild.nodeValue
				.replace(/Date/g, "Start");
		repeat.checked = false;
	}
}

function changeRepeatEnd(name) {
	checkbox = document.getElementById(name);
	checked = checkbox.checked;
	if (checked) {
		setVisible("repeatEnd-label");
		setVisible("repeatEnd-element");
	} else {
		setInvisible("repeatEnd-label");
		setInvisible("repeatEnd-element");
	}
}