[247] | 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" ); |
---|
[265] | 11 | this.containerLogin = $( "#loginModule" ); |
---|
[267] | 12 | this.containerMenu = $( "#menuBO" ); |
---|
[247] | 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)%>"; |
---|
[251] | 19 | this.jSONUser = <%=Context.getJSONUser( request )%> ? <%=Context.getJSONUser( request )%> : false; |
---|
[247] | 20 | this.screenWidthLimit = 1336; |
---|
| 21 | |
---|
| 22 | /** ************ CREATE ************ **/ |
---|
| 23 | this.createTitleTools(); |
---|
[265] | 24 | this.createMenu(); |
---|
[247] | 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 homeButton = new Button( {value:templateTexts["app.home"], parent:this.containerTools, id:"button_home", className: "gray_button", classNameText:"blue_button_text", onClick:this.onClickHome} ); |
---|
| 36 | |
---|
| 37 | var divSmallLogoEther = $( document.createElement( "div" ) ); |
---|
| 38 | divSmallLogoEther.attr( {id:"smallLogoEther", class:"containerSmallLogoEther"} ); |
---|
| 39 | divSmallLogoEther.append( '<a href="http://ether.ipsl.jussieu.fr" target="help"><img src="resources/images/logo_Ether.jpg" width="40px" height="40px"/></a>' ); |
---|
| 40 | this.containerTools.append( divSmallLogoEther ); |
---|
| 41 | $( "#smallLogoEther" ).show(); |
---|
[267] | 42 | |
---|
| 43 | this.updateLogoEther(); |
---|
[247] | 44 | }, |
---|
| 45 | |
---|
| 46 | createLogin: function() |
---|
| 47 | { |
---|
[278] | 48 | var buttonLogin = new LoginButton( { parent:this.containerLogin, urlLogin:"project?methodName=login", urlLogout:"project?methodName=logout", classNameToAdd:"gray" } ); |
---|
[265] | 49 | buttonLogin.setJSONUser( this.jSONUser ); |
---|
| 50 | buttonLogin.display(); |
---|
| 51 | }, |
---|
[247] | 52 | |
---|
[265] | 53 | createMenu: function() |
---|
| 54 | { |
---|
[267] | 55 | var usersButton = new Button( {value:templateTexts["bo.user"], parent:this.containerMenu, id:"button_home", className: "gray_button", classNameText:"blue_button_text", onClick:this.onClickUser} ); |
---|
[247] | 56 | }, |
---|
| 57 | |
---|
| 58 | // EVENTS ******************************************************** |
---|
| 59 | onClickHome: function() |
---|
| 60 | { |
---|
[285] | 61 | document.location.href = "backoffice?methodName=home"; |
---|
[247] | 62 | }, |
---|
| 63 | |
---|
[267] | 64 | onClickUser: function() |
---|
[247] | 65 | { |
---|
[267] | 66 | document.location.href = "backoffice?methodName=viewUser"; |
---|
[247] | 67 | }, |
---|
| 68 | |
---|
[267] | 69 | /** |
---|
| 70 | * This method display a small Ether logo if the screen is too small to contain the big one |
---|
| 71 | */ |
---|
| 72 | updateLogoEther: function() |
---|
[247] | 73 | { |
---|
[267] | 74 | if( this.screenWidthLimit > innerWidth ) |
---|
| 75 | { |
---|
| 76 | $( "#logoEther" ).hide(); |
---|
| 77 | $( "#linkLogoEther" ).hide(); |
---|
| 78 | $( "#smallLogoEther" ).show(); |
---|
| 79 | } |
---|
| 80 | else |
---|
| 81 | { |
---|
| 82 | $( "#logoEther" ).show(); |
---|
| 83 | $( "#linkLogoEther" ).show(); |
---|
| 84 | $( "#smallLogoEther" ).hide(); |
---|
| 85 | } |
---|
[247] | 86 | } |
---|
[267] | 87 | |
---|
[247] | 88 | } ); |
---|
| 89 | |
---|
| 90 | </script> |
---|