/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk
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
$(document).ready(function() {

	$("#addStudentButton").click(function(e) {
		e.stopPropagation();
		e.preventDefault();
		$("#popup").load(
			"ajax/popup/addStudents",
			function() {
				$("#popup").fadeIn(300).click(function(e) {e.stopPropagation();});
				$("#popup .cancelButton").click(cancelHandler);
			}
		);
	});

	$(".editStudentDetailsButton").click(function(e) {
		e.stopPropagation();
		e.preventDefault();

		var username = $(this).parent().prevAll(".username").html();
		var name = $(this).parent().prevAll(".name").html();
		var email = $(this).parent().prevAll(".email").html();

		$("#popup").load(
			"ajax/popup/editStudentDetails",
			function() {
				$("#popup #usernameDisplay").html(username);
				$("#popup #username").val(username);
				$("#popup #studentName").val(name);
				$("#popup #studentEmail").val(email);
				$("#popup").fadeIn(300).click(function(e){e.stopPropagation();});
				$("#popup .cancelButton").click(cancelHandler);
			}
		)

	});

	$("html").click(function(e) {
		e.stopPropagation();
		e.preventDefault();
		$("#popup").fadeOut(300, function() { $(this).html("")});
	});

	$("#viewStudents table tr:even").addClass("even");
	$("#viewStudents table tr:odd").addClass("odd");
});

function cancelHandler(e) {
	e.stopPropagation();
	e.preventDefault();
	$("#popup").fadeOut(300, function() { $(this).find(".popup").remove(); });
}