/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/js/bannermenu.js

  • Committer: a11andoh
  • Date: 2013-05-24 11:28:43 UTC
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: a11andoh@student.his.se-20130524112843-360je7hu7q13r171
added the cms controller to load all content pages.
added first time registration controller to load the views for the registration
pages.
added and fixed temporarypages for the controllers 
and edited the models to be able to get active courses.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
/* Functions that run when the page loads */
4
4
$(document).ready(function() {
5
5
 
6
 
        /* Makes the bannermenu scrollable horizontally but not vertically */
7
 
        $('#bannerBody').scrollToFixed();
8
 
 
9
 
        /* Sets the click-function for the usermenubutton */
 
6
        /* Secures that the dropdownmenus are not shown on pageload */
 
7
        $('#dropdownCodeviewerMenu').hide();
 
8
        $('#dropdownUserMenu').hide();
 
9
 
 
10
        /* Check courses in expanded menu */
 
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*/
 
18
        });
 
19
        
 
20
        /* TODO: ??? */
 
21
        /*
10
22
        $('#bannerUserMenuButton').click(function(e){
11
 
                
12
 
                $.get('ajax/isLoggedIn', function(response) {
13
 
                        if(response == 'yes') {
14
 
                                // If the user is logged in and the usermenu-div is hidden it's shown.
15
 
                                if($('#dropdownUserMenu').is(':hidden')) {
16
 
                                        // TODO: Secure that the courseblock-div is hidden when the usermenu-div is oppened.
17
 
                                        /*
18
 
                                        if($('#dropdownMenuCourseBlock').is(':visible')) {
19
 
                                                $('#dropdownMenuCourseBlock').hide();
20
 
                                        }
21
 
                                        $('#dropdownUserMenu').load('bannermenu.php #dropdownUserMenu');
22
 
                                        */
23
 
                                        $('#dropdownUserMenu').show();
24
 
                                }
25
 
                                // If the user is logged in and the usermenu-div is shown it's hidden.
26
 
                                else {
27
 
                                        $('#dropdownUserMenu').hide();
28
 
                                }
29
 
                        }
30
 
                        else {
31
 
                                // If the user is not logged in and the popup-div is hidden it's filled and shown.
32
 
                                if($('#popup').is(':hidden')) {
33
 
                                        $('#popup').load('ajax/popup/login', function(){
34
 
                                                $('#popup').show();
35
 
                                                $("#popup .hint").click(loginHint);
36
 
                                        });
37
 
                                }
38
 
                                // If the user is not logged in and the popup-div shows it's hidden.
39
 
                                else {
40
 
                                        $('#popup').hide();
41
 
                                }
42
 
                        }
43
 
                });
44
 
                
45
 
        });
46
 
        
47
 
        // TODO: Refresh the div with it's php before show.
48
 
        /* Expand and collapse courses in dropdown menu */
49
 
        $('#dropdownMenuExpandCourses').click(function(){
50
 
        
51
 
                // If the course block is collapsed it's expanded.
52
 
                if($('#dropdownMenuCourseBlock').is(':hidden')) {
53
 
                        $('#dropdownMenuCourseBlock').show();
54
 
                }
55
 
                // If the course block is expanded it's collapsed .
56
 
                else {
57
 
                        $('#dropdownMenuCourseBlock').hide();
58
 
                }
59
 
 
60
 
        });
61
 
});
 
 
b'\\ No newline at end of file'
 
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
        
 
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
        
 
86
        
 
87
});
 
88
 
 
89
/* TODO: Do I need these? */
 
90
/* Global variables */
 
91
var popoutMenu=0;
 
92
var expandedCourses=0;
 
93
 
 
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