source: ether_megapoli/trunk/web/resources/jsp/apple_etherHead.jsp @ 233

Last change on this file since 233 was 233, checked in by vmipsl, 13 years ago

Slides

File size: 7.4 KB
Line 
1<%@ page import="com.medias.Context" %>
2
3<script type="text/javascript">
4    var InterfaceTemplate = Class.create( {
5
6        initialize: function()
7        {
8            /** *********** CONTAINERS *********** **/
9            this.containerTitle = $( "#title" );
10            this.containerTools = $( "#tools" );
11
12            /** *********** VARIABLES *********** **/
13            this.isLanguageFr = <%=Context.getLangue(request).equals( "fr" )%>;
14            this.path = "<%=request.getContextPath()%>";
15            this.webmaster = "<%=Context.getWebmaster(request)%>";
16            this.relativePageUri = "<%=Context.getRelativePath( request )%>?<%=request.getQueryString()%>";
17            this.jSONUser = <%=Context.getUser( request )%> ? <%=Context.getUser( request )%> : false;
18            this.screenWidthLimit = 1336;
19
20            /** ************ CREATE ************ **/
21            this.createTitleTools();
22            this.createLeftSlides();
23            this.updateLogoEther();
24        },
25
26        // CREATES ********************************************************
27        createTitleTools: function()
28        {
29            this.containerTitle.addClass( "containerTitle" );
30            this.containerTitle.html( interfaceTexts["app.fulltitle"] );
31
32            this.createLogin();
33            var mailButton = new ComplexButton( {value:interfaceTexts["data.upload.metadata.contact.mail"], parent:this.containerTools, id:"button_mail", onClick:jQuery.proxy( this.onClickMail, this )} );
34
35            var valueLanguage = interfaceTexts["app.fr"];
36            if( this.isLanguageFr )
37                valueLanguage = interfaceTexts["app.en"];
38
39            var languageButton = new ComplexButton( {value:valueLanguage, parent:this.containerTools, id:"button_language", onClick:jQuery.proxy( this.onClickLanguage, this )} );
40            var homeButton = new ComplexButton( {value:interfaceTexts["app.home"], parent:this.containerTools, id:"button_home", onClick:this.onClickHome} );
41
42            var divSmallLogoEther = $( document.createElement( "div" ) );
43            divSmallLogoEther.attr( {id:"smallLogoEther", class:"containerSmallLogoEther"} );
44            divSmallLogoEther.append( '<a href="http://ether.ipsl.jussieu.fr" target="help"><img src="resources/images/logo_Ether.jpg" width="40px" height="40px"/></a>' );
45            this.containerTools.append( divSmallLogoEther );
46        },
47
48        createLogin: function()
49        {
50            var containerLoginButton = $( "#button_login" );
51
52            if( this.jSONUser )
53            {
54                var textLogin = this.jSONUser.name + " " + this.jSONUser.firstName;
55                if( this.jSONUser.role && this.jSONUser.role == "coordinateur" )
56                    textLogin += " (" + interfaceTexts["app.admin"] + ")";
57
58                var loginButton = new ComplexButton( {value:textLogin, parent:this.containerTools, id:"button_login"} );
59
60                $( "#button_login #button_middle #button_text" ).addClass( "containerUserLogout" );
61
62                var loginMiddle = $( "#button_login #button_middle" );
63                var divImgLogout = $( document.createElement( "div" ) );
64                divImgLogout.addClass( "containerImgLogout" );
65                divImgLogout.append( "<img src='resources/images/utils/logout.png' width='15px' height='15px/>" );
66                divImgLogout.bind( "click", this.onClickLogout );
67                loginMiddle.append( divImgLogout );
68            }
69            else
70            {
71                var loginButton = new ComplexButton( {value:interfaceTexts["app.connexion"], parent:this.containerTools, id:"button_login"} );
72
73                var loginMiddle = $( "#button_login #button_middle" );
74                loginMiddle.empty();
75                loginMiddle.attr( {id:"topnav", class:"topnav complexButton_middle"} );
76                var aLogin = $( document.createElement( "a" ) );
77                aLogin.attr( {href:"login", class:"signin"} );
78                aLogin.html( "<span>" + interfaceTexts["app.connexion"] + "</span>" );
79                loginMiddle.append( aLogin );
80
81                $( document ).ready( function()
82                {
83                    $( ".signin" ).click( function( e )
84                    {
85                        e.preventDefault();
86                        $( "fieldset#signin_menu" ).toggle();
87                        $( ".signin" ).toggleClass( "menu-open" );
88                    } );
89
90                    $( "fieldset#signin_menu" ).mouseup( function()
91                    {
92                        return false
93                    } );
94
95                    $( document ).mouseup( function( e )
96                    {
97                        if( $( e.target ).parent( "a.signin" ).length == 0 )
98                        {
99                            $( ".signin" ).removeClass( "menu-open" );
100                            $( "fieldset#signin_menu" ).hide();
101                        }
102                    } );
103                } );
104
105                $( function()
106                {
107                    $( '#forgot_username_link' ).tipsy( {gravity: 'w'} );
108                } );
109            }
110        },
111
112        createLeftSlides: function()
113        {
114            var divSlideCredits = new Slide( { contentId:"slideContentCredits", buttonId: "slideCredits", parent:$( "#creditSlide" ), isIndexToChange:true,
115                contentButton:"<img src='resources/icons/man_credits.gif' width='50px' height='50px'/><br/>" , contentSlide:"CREDDDDIIITS"} );
116
117            var divSlideMentions = new Slide( { contentId:"slideContentMentions", buttonId: "slideMentions", parent:$( "#mentionSlide" ),specificButtonClass:"containerSlideButtonMentions", isIndexToChange:true,
118                contentButton:"<img src='resources/icons/man_mentions_2.png' width='50px' height='50px'/><br/>", contentSlide:"MENTIIIOOONNSS"} );
119
120            var divSlideInfos = new Slide( { contentId:"slideContentInfos", buttonId: "slideInfos", parent:$( "#infoSlide" ), specificButtonClass:"containerSlideButtonInfos", isIndexToChange:true,
121                contentButton:"<img src='resources/icons/man_info.gif' width='50px' height='50px'/>", contentSlide:"IINNFFFOOOOSSS"} );
122        },
123
124        // EVENTS ********************************************************
125        onClickHome: function()
126        {
127            document.location.href = "index.jsp";
128        },
129
130        onClickLogout: function()
131        {
132            document.location.href = "Disconnect.do";
133        },
134
135        onClickLanguage: function()
136        {
137            if( this.isLanguageFr )
138                document.location.href = this.path + "/English.do?requestUri=" + this.relativePageUri;
139            else
140                document.location.href = this.path + "/French.do?requestUri=" + this.relativePageUri;
141        },
142
143        onClickMail: function()
144        {
145            document.location.href = "mailto:" + this.webmaster + "?subject=[MEGAPOLI]";
146        },
147
148        /**
149         * This method display a small Ether logo if the screen is too small to contain the big one
150         */
151        updateLogoEther: function()
152        {
153            if( this.screenWidthLimit > innerWidth )
154            {
155                $( "#logoEther" ).hide();
156                $( "#linkLogoEther" ).hide();
157                $( "#smallLogoEther" ).show();
158            }
159            else
160            {
161                $( "#logoEther" ).show();
162                $( "#linkLogoEther" ).show();
163                $( "#smallLogoEther" ).hide();
164            }
165        }
166    } );
167
168</script>
Note: See TracBrowser for help on using the repository browser.