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