- Timestamp:
- 03/05/12 16:23:47 (12 years ago)
- Location:
- tapas/web
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
tapas/web/init.jsp
r389 r396 6 6 <tiles:insert page="/resources/templates/templateEther.jsp" flush="true"> 7 7 8 <tiles:put name="insertCss" type="string" ></tiles:put>8 <tiles:put name="insertCss" type="string"/> 9 9 <tiles:put name="insertJsOrJsp" type="string"> 10 <ether:htmlJsp jspFile="init_script"></ether:htmlJsp> 10 <ether:htmlJs jsFile="library/jquery.json-2.3"/> 11 <ether:htmlJsp jspFile="init_script"/> 11 12 </tiles:put> 12 13 -
tapas/web/init_script.jsp
r389 r396 28 28 }, 29 29 30 31 30 // REQUESTS ******************************************************** 32 31 requestCreateXML: function() 33 32 { 34 // alert(this.input1.val()+' - '+$("#2").val()); 35 $.ajax( { 36 url: "project?methodName=createUserRequest&input1="+this.input1.val()+"&input2="+$("#2").val(), 37 success:jQuery.proxy( this.handleCreateXML, this ) 38 } ); 33 var jsonFormXml = this.serializeFormXMLToJson(); 34 if( jsonFormXml ) 35 $.ajax( { 36 url: "project?methodName=createUserRequest&jsonFormXML=" + jsonFormXml, 37 success:jQuery.proxy( this.handleCreateXML, this ) 38 } ); 39 39 }, 40 40 … … 42 42 handleCreateXML: function( result ) 43 43 { 44 // alert("XML créé");45 44 var bob = jQuery.parseJSON( result ).result; 46 alert(bob); 47 45 alert( bob ); 48 46 }, 49 47 50 48 51 49 // EVENTS ******************************************************** 52 53 50 onClickSubmit: function() 54 51 { 55 52 this.requestCreateXML(); 53 }, 54 55 // OTHERS ******************************************************** 56 serializeFormXMLToJson: function() 57 { 58 var formXML = new Object(); 59 formXML.input1 = $( "#1" ).val(); 60 formXML.input2 = $( "#2" ).val(); 61 return $.toJSON( formXML ); 56 62 } 57 58 63 59 64 } ); -
tapas/web/resources/templates/templateEther.jsp
r388 r396 1 <%@ page import="com.ether.Context" %> 1 2 <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 3 <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> … … 115 116 <div id="containerCenter" class="containerTapas containerCenter"> 116 117 <tiles:insert attribute="body"/> 118 119 <BR/> 120 <%=Context.getPageURI( request )%><BR/> 121 <%=Context.getRelativePageURI( request )%><BR/> 122 <%=Context.getRelativePath( request )%><BR/> 123 <%=Context.getWebroot( request )%><BR/> 124 <%=request.getQueryString()%><BR/> 125 <%=request.getContextPath()%><BR/> 126 <%=request.getPathInfo()%><BR/> 127 <%=request.getServletPath()%><BR/> 128 <%=request.getRequestURL()%><BR/> 117 129 </div> 118 130 … … 129 141 var templateTexts = $A( "" ); 130 142 templateTexts["label.home"] = '<spring:message code="label.home"/>'; 131 templateTexts["label.language. fr"] = '<spring:message code="label.language.fr"/>';132 templateTexts["label.language. en"] = '<spring:message code="label.language.en"/>';143 templateTexts["label.language.to.fr"] = '<spring:message code="label.language.to.fr"/>'; 144 templateTexts["label.language.to.en"] = '<spring:message code="label.language.to.en"/>'; 133 145 templateTexts["label.mail"] = '<spring:message code="label.mail"/>'; 134 146 templateTexts["label.map"] = '<spring:message code="label.map"/>'; -
tapas/web/resources/templates/templateEther_script.jsp
r388 r396 2 2 3 3 <script type="text/javascript"> 4 var InterfaceTemplate = Class.create( {4 var InterfaceTemplate = Class.create( { 5 5 6 initialize: function() 6 initialize: function() 7 { 8 /** *********** CONTAINERS *********** **/ 9 this.containerTools = $( "#tools" ); 10 this.containerLogin = $( "#loginModule" ); 11 this.containerMenuData = $( "#menuData" ); 12 13 /** *********** VARIABLES *********** **/ 14 this.isLanguageFr = <%=Context.getLangue(request).equals( "fr" )%>; 15 this.webmaster = "<%=Context.getWebmaster(request)%>"; 16 <%--this.jSONUser = <%=Context.getJSONUser( request )%> ? <%=Context.getJSONUser( request )%> : false;--%> 17 18 /** ************ CREATE ************ **/ 19 // this.createLogin(); 20 this.createTools(); 21 this.updateLoginOrLogout(); 22 }, 23 24 // CREATES ******************************************************** 25 createTools: function() 26 { 27 var mailButton = new Button( {value:templateTexts["label.mail"], parent:this.containerTools, id:"button_mail", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickMail, this )} ); 28 29 // var valueLanguage = templateTexts["label.language.fr"]; 30 // if( this.isLanguageFr ) 31 // valueLanguage = templateTexts["label.language.en"]; 32 33 <%--var languageButton = new Button( {value: templateTexts["label.language.<%=Context.getLocale( request )%>"], parent:this.containerTools, id:"button_language", className: "red_button_text", onClick:jQuery.proxy( this.onClickLanguage, this )} );--%> 34 var languageButton = new Button( {value:templateTexts["label.language.to.<%=Context.getLocale( request )%>"], parent:this.containerTools, id:"button_language", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickLanguage, this )} ); 35 var homeButton = new Button( {value:templateTexts["label.home"], parent:this.containerTools, id:"button_home", className: "red_button", classNameText:"red_button_text", onClick:this.onClickHome} ); 36 }, 37 38 createLogin: function() 39 { 40 this.loginModule = new LoginButton( {parent:this.containerLogin, urlLogin:"project?methodName=login", urlLogout:"project?methodName=logout", isNeededInscription:true, callbackInscription:jQuery.proxy( this.onClickInscription, this ), anotherOnClickLogin:this.updateLoginOrLogout, anotherOnClickLogout:this.updateLoginOrLogout } ); 41 this.loginModule.setJSONUser( this.jSONUser ); 42 this.loginModule.display(); 43 setLoginModule( this.loginModule ); 44 }, 45 46 // REQUESTS ******************************************************** 47 48 // EVENTS ******************************************************** 49 onClickHome: function() 50 { 51 document.location.href = "index.jsp"; 52 }, 53 54 onClickLanguage: function() 55 { 56 this.path = "<%=request.getContextPath()%>"; 57 this.webmaster = "<%=Context.getWebmaster(request)%>"; 58 59 alert("<%=request.getQueryString()%>||<%=Context.getRelativePath( request )%>||<%=Context.getRelativePageURI(request)%>"); 60 61 this.relativePageUri = <%=request.getQueryString() != null%> ? "<%=Context.getRelativePath( request )%>?<%=request.getQueryString()%>" : "<%=Context.getRelativePageURI(request)%>"; 62 63 alert( this.relativePageUri + " " +<%=Context.isFrench(request)%> ); 64 if( <%=Context.isFrench(request)%> ) 65 document.location.href = this.path + this.relativePageUri + "&language=en"; 66 else 67 document.location.href = this.path + this.relativePageUri + "&language=fr"; 68 }, 69 70 onClickMail: function() 71 { 72 document.location.href = "mailto:" + this.webmaster + "?subject=[TAPAS]"; 73 }, 74 75 onClickInscription: function() 76 { 77 var dataProtocol = "resources/jsp/dataProtocol_fr.jsp"; 78 if( !this.isLanguageFr ) 79 dataProtocol = "resources/jsp/dataProtocol_en.jsp"; 80 81 var $dialog = $( '<div></div>' ) 82 .load( dataProtocol ) 83 .dialog( { 84 autoOpen: false, 85 title: loginTexts["login.inscription"], 86 height: 800, 87 width: 750 88 } ); 89 $dialog.dialog( 'open' ); 90 91 // TODO : see with $dialog.ready() to manage buttons 92 }, 93 94 updateLoginOrLogout: function() 95 { 96 <%--if( "<%=UserRole.ADMINISTRATOR%>" == getJSONUserRole() )--%> 97 <%--$( "#button_bo" ).show();--%> 98 <%--else--%> 99 <%--$( "#button_bo" ).hide();--%> 100 } 101 102 } ); 103 104 /** ******************************* **/ 105 /** *********** ACCOUNT *********** **/ 106 /** ******************************* **/ 107 function onClickAcceptDataProtocol() 7 108 { 8 /** *********** CONTAINERS *********** **/ 9 this.containerTools = $( "#tools" ); 10 this.containerLogin = $( "#loginModule" ); 11 this.containerMenuData = $( "#menuData" ); 109 if( '' == $( "#lastName" ).val() || '' == $( "#email" ).val() || '' == $( "#password" ).val() ) 110 { 111 showErrorAccount( null, templateTexts["login.dataProtocolFields"] ); 112 return; 113 } 12 114 13 /** *********** VARIABLES *********** **/ 14 this.isLanguageFr = <%=Context.getLangue(request).equals( "fr" )%>; 15 this.path = "<%=request.getContextPath()%>"; 16 setPath( this.path ); 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 21 /** ************ CREATE ************ **/ 22 // this.createLogin(); 23 this.createTools(); 24 this.createMenuData(); 25 this.updateLoginOrLogout(); 26 }, 27 28 // CREATES ******************************************************** 29 createTools: function() 30 { 31 var mailButton = new Button( {value:templateTexts["label.mail"], parent:this.containerTools, id:"button_mail", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickMail, this )} ); 32 33 var valueLanguage = templateTexts["label.language.fr"]; 34 if( this.isLanguageFr ) 35 valueLanguage = templateTexts["label.language.en"]; 36 37 var languageButton = new Button( {value:valueLanguage, parent:this.containerTools, id:"button_language", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickLanguage, this )} ); 38 var homeButton = new Button( {value:templateTexts["label.home"], parent:this.containerTools, id:"button_home", className: "red_button", classNameText:"red_button_text", onClick:this.onClickHome} ); 39 }, 40 41 createLogin: function() 42 { 43 this.loginModule = new LoginButton( {parent:this.containerLogin, urlLogin:"project?methodName=login", urlLogout:"project?methodName=logout", isNeededInscription:true, callbackInscription:jQuery.proxy( this.onClickInscription, this ), anotherOnClickLogin:this.updateLoginOrLogout, anotherOnClickLogout:this.updateLoginOrLogout } ); 44 this.loginModule.setJSONUser( this.jSONUser ); 45 this.loginModule.display(); 46 setLoginModule( this.loginModule ); 47 }, 48 49 createMenuData: function() 50 { 51 this.containerMenuData.empty(); 52 53 var ulData = $( document.createElement( "ul" ) ); 54 this.containerMenuData.append( ulData ); 55 56 var liExtract = $( document.createElement( "li" ) ); 57 liExtract.append( '<a onclick=\'javascript:neededLogin("/DataAccess.do")\'><span>' + templateTexts["data.access.extract.short"] + '</span></a>' ); 58 ulData.append( liExtract ); 59 60 var liDownload = $( document.createElement( "li" ) ); 61 liDownload.append( '<a onclick=\'javascript:neededLogin("/PrepareTree.do")\'><span>' + templateTexts["data.upload.short"] + '</span></a>' ); 62 ulData.append( liDownload ); 63 }, 64 65 // REQUESTS ******************************************************** 66 67 // EVENTS ******************************************************** 68 onClickHome: function() 69 { 70 document.location.href = "index.jsp"; 71 }, 72 73 onClickLanguage: function() 74 { 75 if( this.isLanguageFr ) 76 document.location.href = this.path + "/English.do?requestUri=" + this.relativePageUri; 115 if( $( "#checkboxUser" ).attr( 'checked' ) ) 116 createAccount(); 77 117 else 78 document.location.href = this.path + "/French.do?requestUri=" + this.relativePageUri; 79 }, 80 81 onClickMail: function() 82 { 83 document.location.href = "mailto:" + this.webmaster + "?subject=[TAPAS]"; 84 }, 85 86 onClickInscription: function() 87 { 88 var dataProtocol = "resources/jsp/dataProtocol_fr.jsp"; 89 if( !this.isLanguageFr ) 90 dataProtocol = "resources/jsp/dataProtocol_en.jsp"; 91 92 var $dialog = $( '<div></div>' ) 93 .load( dataProtocol ) 94 .dialog( { 95 autoOpen: false, 96 title: loginTexts["login.inscription"], 97 height: 800, 98 width: 750 99 } ); 100 $dialog.dialog( 'open' ); 101 102 // TODO : see with $dialog.ready() to manage buttons 103 }, 104 105 updateLoginOrLogout: function() 106 { 107 <%--if( "<%=UserRole.ADMINISTRATOR%>" == getJSONUserRole() )--%> 108 <%--$( "#button_bo" ).show();--%> 109 <%--else--%> 110 <%--$( "#button_bo" ).hide();--%> 118 showErrorAccount( null, templateTexts["login.dataProtocolAccept"] ); 111 119 } 112 120 113 } ); 114 115 /** ******************************* **/ 116 /** *********** ACCOUNT *********** **/ 117 /** ******************************* **/ 118 function onClickAcceptDataProtocol() 119 { 120 if( '' == $( "#lastName" ).val() || '' == $( "#email" ).val() || '' == $( "#password" ).val() ) 121 function createAccount() 121 122 { 122 showErrorAccount( null, templateTexts["login.dataProtocolFields"] ); 123 return; 123 var parametersUrl = "name=" + $( "#lastName" ).val() + "&firstName=" + $( "#firstName" ).val() + "&email=" + $( "#email" ).val() + "&pwd=" + $( "#password" ).val(); 124 var request = $.ajax( { 125 url: "project?methodName=createAccount&" + parametersUrl, 126 success:handleCreateAccount, 127 error: showErrorAccount 128 } ); 124 129 } 125 130 126 if( $( "#checkboxUser" ).attr( 'checked' ) ) 127 createAccount(); 128 else 129 showErrorAccount( null, templateTexts["login.dataProtocolAccept"] ); 130 } 131 function handleCreateAccount() 132 { 133 $( "#infosAccount" ).hide(); 134 $( "#infosAccount" ).removeClass( "containerErrors" ); 135 $( "#infosAccount" ).addClass( "containerInfos" ); 136 $( "#infosAccount" ).html( templateTexts["login.dataProtocol.account"] ); 137 $( "#infosAccount" ).show(); 138 } 131 139 132 function createAccount()133 {134 var parametersUrl = "name=" + $( "#lastName" ).val() + "&firstName=" + $( "#firstName" ).val() + "&email=" + $( "#email" ).val() + "&pwd=" + $( "#password" ).val();135 var request = $.ajax( {136 url: "project?methodName=createAccount&" + parametersUrl,137 success:handleCreateAccount,138 error: showErrorAccount139 } );140 } 140 function showErrorAccount( result, text ) 141 { 142 $( "#infosAccount" ).hide(); 143 $( "#infosAccount" ).removeClass( "containerInfos" ); 144 $( "#infosAccount" ).addClass( "containerErrors" ); 145 if( null != result ) 146 $( "#infosAccount" ).html( templateTexts[result.responseText] ); 147 else 148 $( "#infosAccount" ).html( text ); 141 149 142 function handleCreateAccount() 143 { 144 $( "#infosAccount" ).hide(); 145 $( "#infosAccount" ).removeClass( "containerErrors" ); 146 $( "#infosAccount" ).addClass( "containerInfos" ); 147 $( "#infosAccount" ).html( templateTexts["login.dataProtocol.account"] ); 148 $( "#infosAccount" ).show(); 149 } 150 151 function showErrorAccount( result, text ) 152 { 153 $( "#infosAccount" ).hide(); 154 $( "#infosAccount" ).removeClass( "containerInfos" ); 155 $( "#infosAccount" ).addClass( "containerErrors" ); 156 if( null != result ) 157 $( "#infosAccount" ).html( templateTexts[result.responseText] ); 158 else 159 $( "#infosAccount" ).html( text ); 160 161 $( "#infosAccount" ).show(); 162 } 150 $( "#infosAccount" ).show(); 151 } 163 152 </script> -
tapas/web/src/com/ether/Controller.java
r389 r396 4 4 import com.ether.annotation.Mandatory; 5 5 import com.ether.annotation.ParamName; 6 import com.ether.annotation.UseJSON; 6 7 import net.sf.json.JSONObject; 7 8 import org.apache.commons.logging.Log; … … 11 12 12 13 import java.util.HashMap; 13 import java.util.List;14 14 import java.util.Map; 15 15 16 16 /** 17 17 * @author vmipsl 18 * @date 17 feb 201118 * @date 05 march 2012 19 19 */ 20 20 public class Controller … … 24 24 /** *********************************************************** **/ 25 25 /** *********************** VIEWS ***************************** **/ 26 /** 27 * ********************************************************** * 28 */ 26 /** *********************************************************** **/ 29 27 @ControllerMethod(view = VIEW_INIT) 30 28 public Map<String, Object> home() … … 37 35 /** *********************************************************** **/ 38 36 /** *********************** CALLS ***************************** **/ 39 /** 40 * ********************************************************** * 41 */ 42 37 /** *********************************************************** **/ 43 38 @ControllerMethod(jsonResult = true) 44 public JSONObject createUserRequest( @ParamName(" input1") final String input1, @ParamName("input2") final String input2)39 public JSONObject createUserRequest( @ParamName("jsonFormXML") @Mandatory @UseJSON final FormXML jsonFormXML ) 45 40 throws ServiceException 46 41 { 47 48 42 //appel a createxml 49 43 _tapasService.createXMLRequest(); 50 44 51 52 45 final JSONObject result = new JSONObject(); 53 result.put( "result", "SUCCESS" );46 result.put( "result", "SUCCESS" ); 54 47 return result; 55 48 } -
tapas/web/src/messages_en.properties
r389 r396 1 1 inWork=Work in progress.. 2 2 language=English 3 label.language. fr=French4 label.language. en=English3 label.language.to.en=French 4 label.language.to.fr=English 5 5 label.language=Language 6 6 -
tapas/web/src/messages_fr.properties
r389 r396 1 1 inWork=Page en cours de construction.. 2 2 language=Français 3 label.language. fr=Français4 label.language. en=Anglais3 label.language.to.en=Français 4 label.language.to.fr=Anglais 5 5 label.language=Langue 6 6
Note: See TracChangeset
for help on using the changeset viewer.