source: ether_2012/trunk/web/resources/templates/templateEther_script.jsp @ 345

Last change on this file since 345 was 345, checked in by vmipsl, 12 years ago

install

File size: 3.9 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            this.containerLogin = $( "#loginModule" );
12            this.containerMenu = $( "#menuBO" );
13
14            /** *********** VARIABLES *********** **/
15            this.isLanguageFr = <%=Context.getLangue(request).equals( "fr" )%>;
16            this.path = "<%=request.getContextPath()%>";
17            this.webmaster = "<%=Context.getWebmaster(request)%>";
18            this.relativePageUri = <%=request.getQueryString() != null%> ? "<%=Context.getRelativePath( request )%>?<%=request.getQueryString()%>" : "<%=Context.getRelativePageURI(request)%>";
19            this.jSONUser = <%=Context.getJSONUser( request )%> ? <%=Context.getJSONUser( request )%> : false;
20            this.screenWidthLimit = 1336;
21
22            /** ************ CREATE ************ **/
23            this.createTitleTools();
24            this.createMenu();
25        },
26
27        // CREATES ********************************************************
28        createTitleTools: function()
29        {
30            this.containerTitle.addClass( "containerTitle" );
31            this.containerTitle.html( templateTexts["bo.fulltitle"] );
32
33            this.createLogin();
34
35            var interfaceButton = new Button( {value:templateTexts["bo.site"], parent:this.containerTools, id:"button_interface", className: "gray_button", classNameText:"blue_button_text", onClick:this.onClickMegapoli} );
36            var homeButton = new Button( {value:templateTexts["app.home"], parent:this.containerTools, id:"button_home", className: "gray_button", classNameText:"blue_button_text", onClick:this.onClickHome} );
37
38//            var divSmallLogoEther = $( document.createElement( "div" ) );
39//            divSmallLogoEther.attr( {id:"smallLogoEther", class:"containerSmallLogoEther"} );
40//            divSmallLogoEther.append( '<a href="http://ether.ipsl.jussieu.fr" target="help"><img src="resources/images/logo_Ether.jpg" width="40px" height="40px"/></a>' );
41//            this.containerTools.append( divSmallLogoEther );
42//            $( "#smallLogoEther" ).show();
43
44            this.updateLogoEther();
45        },
46
47        createLogin: function()
48        {
49            var buttonLogin = new LoginButton( { parent:this.containerLogin, urlLogin:"project?methodName=login", urlLogout:"project?methodName=logout", classNameToAdd:"gray" } );
50            buttonLogin.setJSONUser( this.jSONUser );
51            buttonLogin.display();
52        },
53
54        createMenu: function()
55        {
56            var usersButton = new Button( {value:templateTexts["bo.user"], parent:this.containerMenu, id:"button_home", className: "gray_button", classNameText:"blue_button_text", onClick:this.onClickUser} );
57        },
58
59        // EVENTS ********************************************************
60        onClickHome: function()
61        {
62            document.location.href = "backoffice?methodName=home";
63        },
64
65        onClickMegapoli: function()
66        {
67            document.location.href = "index.jsp";
68        },
69
70        onClickUser: function()
71        {
72            document.location.href = "backoffice?methodName=viewUser";
73        },
74
75        /**
76         * This method display a small Ether logo if the screen is too small to contain the big one
77         */
78        updateLogoEther: function()
79        {
80            if( this.screenWidthLimit > innerWidth )
81            {
82                $( "#logoEther" ).hide();
83                $( "#linkLogoEther" ).hide();
84                $( "#smallLogoEther" ).show();
85            }
86            else
87            {
88                $( "#logoEther" ).show();
89                $( "#linkLogoEther" ).show();
90                $( "#smallLogoEther" ).hide();
91            }
92        }
93
94    } );
95
96</script>
Note: See TracBrowser for help on using the repository browser.