/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk
85.2.1 by a11emmjo
Combined bannermenu with startview to get correct start-page.
1
/* TODO: cHANGE THIS FILE ENTIRELY!!! CHANGE CALLED ID'S AND CLASSES */
67.1.6 by a11emmjo
Replaced bannermenu/topmenu/header... on login-page.
2
85.2.1 by a11emmjo
Combined bannermenu with startview to get correct start-page.
3
/* Functions that run when the page loads */
4
$(document).ready(function() {
90.1.2 by a11emmjo
Made a standard css-file to be used for the whole lenasys-page.
5
85.2.1 by a11emmjo
Combined bannermenu with startview to get correct start-page.
6
	/* Secures that the dropdownmenus are not shown on pageload */
7
	$('#dropdownCodeviewerMenu').hide();
90.1.2 by a11emmjo
Made a standard css-file to be used for the whole lenasys-page.
8
	$('#dropdownUserMenu').hide();
67.1.6 by a11emmjo
Replaced bannermenu/topmenu/header... on login-page.
9
10
	/* Check courses in expanded menu */
85.2.1 by a11emmjo
Combined bannermenu with startview to get correct start-page.
11
	$('li.dropdownMenuCourseBlockNonActiveCourse').click(function(){
12
		$('li.dropdownMenuCourseBlockActiveCourse').addClass('dropdownMenuCourseBlockNonActiveCourse');
13
		$('li.dropdownMenuCourseBlockActiveCourse').removeClass('dropdownMenuCourseBlockActiveCourse');
14
15
		$(this).removeClass('dropdownMenuCourseBlockNonActiveCourse');
16
		$(this).addClass("dropdownMenuCourseBlockActiveCourse");
17
		/*TA BORT DEN ENA KLASSEN OCH ANVÄND TOGGLE*/
67.1.6 by a11emmjo
Replaced bannermenu/topmenu/header... on login-page.
18
	});
90.1.2 by a11emmjo
Made a standard css-file to be used for the whole lenasys-page.
19
	
20
	/* TODO: ??? */
21
	/*
22
	$('#bannerUserMenuButton').click(function(e){
23
		// fetch form through ajax
24
		// add to DOM
25
		// make visible
26
		var target = $('#loginPopup');
27
		if(target.is(":hidden")){
28
			target.fadeIn(300);
29
			$('#username').focus();
30
			e.stopPropagation();
31
		}
32
		else{
33
			// make not visible
34
			// remove from DOM
35
			target.fadeOut(300);
36
		}
37
		
38
	});
39
	*/
40
	
41
	
42
	/* ROLLES KOD NEDAN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
43
	
67.1.6 by a11emmjo
Replaced bannermenu/topmenu/header... on login-page.
44
	/* TODO: SHOULD OPEN A POPUP VIA AJAX */
45
	/* Blurs body and opens password changer */
46
	$('li[name="changePwd"]').click(function(e){
47
		e.stopPropagation();
48
		$('#popoutMenu').stop(false, false).slideUp(300);
49
		popoutMenu=0;
50
	    $('body *').not('#passwordChanger, #passwordChanger *').animate({
51
		opacity:0.4}, 400);
52
		$('#passwordChanger').fadeIn(300);
53
		$('#passwordChanger').css('z-index', 3000);
54
	});
55
	
56
	$('body').click(function(e){
57
		$('#formContainer').fadeOut(300);
58
		$('#passwordChanger').fadeOut(300);
59
		$('body *').animate({
60
		opacity:1}, 400);
61
		$('#changePassword')[0].reset();
62
	});
63
	
64
	$('#passwordChanger').click(function(e){
65
		e.stopPropagation();
66
	});
67
	
68
	$('#formContainer').click(function(e){
69
		e.stopPropagation();
70
	});
71
	
72
	$('#popoutLink').click(function(e){
73
		if(popoutMenu==0){
74
			$('#popoutMenu').stop(false, true).slideDown(300);
75
			popoutMenu=1;
76
			e.stopPropagation();
77
		// FIXA SÅ MENYN INTE KOMMER UPP IGEN
78
		}
79
		else if(popoutMenu==1){
80
			$('#popoutMenu').stop(false, false).slideUp(300);	
81
			popoutMenu=0;
82
			e.stopPropagation();
83
		}
84
	});
85
	
90.1.2 by a11emmjo
Made a standard css-file to be used for the whole lenasys-page.
86
	
67.1.6 by a11emmjo
Replaced bannermenu/topmenu/header... on login-page.
87
});
88
90.1.2 by a11emmjo
Made a standard css-file to be used for the whole lenasys-page.
89
/* TODO: Do I need these? */
90
/* Global variables */
91
var popoutMenu=0;
92
var expandedCourses=0;
93
67.1.6 by a11emmjo
Replaced bannermenu/topmenu/header... on login-page.
94
window.onkeyup = function(event){
95
	if(event.keyCode==27){
96
		$('#formContainer').fadeOut(300);
97
		$('#passwordChanger').fadeOut(300);
98
		$('body *').animate({
99
		opacity:1}, 400);
100
		$('#changePassword')[0].reset();
101
	}
102
}
103
104
/* Closing password changer and reactivates body */
105
function cancelPasswordChange(){
106
	$('#passwordChanger').fadeOut(300);
107
	$('body *').animate({
108
	opacity:1}, 400);
109
	$('#changePassword')[0].reset();
110
}
111
112
113
/* Expand/Collapse courses in popout menu */
114
function expandCourses(){
115
	if(expandedCourses==0){
116
	$('#expandedCourses').stop(false, true).slideDown(300);
117
	expandedCourses=1;
118
	}
119
	else if(expandedCourses==1){
120
		$('#expandedCourses').stop(false, false).slideUp(300);	
121
		expandedCourses=0;
122
	}
123
}
124