Index: tapas/web/init_script.jsp
===================================================================
--- tapas/web/resources/templates/templateEther_script.jsp	(revision 388)
+++ tapas/web/init_script.jsp	(revision 389)
@@ -1,163 +1,62 @@
-<%@ page import="com.ether.Context" %>
+<script type="text/javascript">
+    var InterfaceInit = Class.create( {
 
-<script type="text/javascript">
-var InterfaceTemplate = Class.create( {
+        initialize: function()
+        {
+            /** *********** CONTAINERS *********** **/
+            this.containerForm = $( "#formulaire" );
 
-    initialize: function()
-    {
-        /** *********** CONTAINERS *********** **/
-        this.containerTools = $( "#tools" );
-        this.containerLogin = $( "#loginModule" );
-        this.containerMenuData = $( "#menuData" );
+            this.createForm();
 
-        /** *********** VARIABLES *********** **/
-        this.isLanguageFr = <%=Context.getLangue(request).equals( "fr" )%>;
-        this.path = "<%=request.getContextPath()%>";
-        setPath( this.path );
-        this.webmaster = "<%=Context.getWebmaster(request)%>";
-        this.relativePageUri = <%=request.getQueryString() != null%> ? "<%=Context.getRelativePath( request )%>?<%=request.getQueryString()%>" : "<%=Context.getRelativePageURI(request)%>";
-        <%--this.jSONUser = <%=Context.getJSONUser( request )%> ? <%=Context.getJSONUser( request )%> : false;--%>
+        },
 
-        /** ************ CREATE ************ **/
-//        this.createLogin();
-        this.createTools();
-        this.createMenuData();
-        this.updateLoginOrLogout();
-    },
+        // CREATES ********************************************************
+        createForm: function()
+        {
+            // Create button elements
+            this.input1 = $( document.createElement( "input" ) );
+            var input2 = $( document.createElement( "input" ) );
 
-    // CREATES ********************************************************
-    createTools: function()
-    {
-        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 )} );
+            this.input1.attr( {id:"1"} );
+            this.containerForm.append( this.input1 );
 
-        var valueLanguage = templateTexts["label.language.fr"];
-        if( this.isLanguageFr )
-            valueLanguage = templateTexts["label.language.en"];
+            input2.attr( {id:"2"} );
+            this.containerForm.append( input2 );
 
-        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 )} );
-        var homeButton = new Button( {value:templateTexts["label.home"], parent:this.containerTools, id:"button_home", className: "red_button", classNameText:"red_button_text", onClick:this.onClickHome} );
-    },
+            var submitButton = new Button( {value:initTexts["label.submitButton"], parent:this.containerForm, id:"button_submit", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickSubmit, this )} );
 
-    createLogin: function()
-    {
-        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 } );
-        this.loginModule.setJSONUser( this.jSONUser );
-        this.loginModule.display();
-        setLoginModule( this.loginModule );
-    },
+        },
 
-    createMenuData: function()
-    {
-        this.containerMenuData.empty();
 
-        var ulData = $( document.createElement( "ul" ) );
-        this.containerMenuData.append( ulData );
+        // REQUESTS ********************************************************
+        requestCreateXML: function()
+        {
+//            alert(this.input1.val()+' - '+$("#2").val());
+            $.ajax( {
+                url: "project?methodName=createUserRequest&input1="+this.input1.val()+"&input2="+$("#2").val(),
+                success:jQuery.proxy( this.handleCreateXML, this )
+            } );
+        },
 
-        var liExtract = $( document.createElement( "li" ) );
-        liExtract.append( '<a onclick=\'javascript:neededLogin("/DataAccess.do")\'><span>' + templateTexts["data.access.extract.short"] + '</span></a>' );
-        ulData.append( liExtract );
+        // HANDLES ******************************************************** = retours ajax
+        handleCreateXML: function( result )
+        {
+//            alert("XML crÃ©Ã©");
+            var bob = jQuery.parseJSON( result ).result;
+            alert(bob);
 
-        var liDownload = $( document.createElement( "li" ) );
-        liDownload.append( '<a onclick=\'javascript:neededLogin("/PrepareTree.do")\'><span>' + templateTexts["data.upload.short"] + '</span></a>' );
-        ulData.append( liDownload );
-    },
+        },
 
-    // REQUESTS ********************************************************
 
-    // EVENTS ********************************************************
-    onClickHome: function()
-    {
-        document.location.href = "index.jsp";
-    },
+        // EVENTS ********************************************************
 
-    onClickLanguage: function()
-    {
-        if( this.isLanguageFr )
-            document.location.href = this.path + "/English.do?requestUri=" + this.relativePageUri;
-        else
-            document.location.href = this.path + "/French.do?requestUri=" + this.relativePageUri;
-    },
+        onClickSubmit: function()
+        {
+            this.requestCreateXML();
+        }
 
-    onClickMail: function()
-    {
-        document.location.href = "mailto:" + this.webmaster + "?subject=[TAPAS]";
-    },
 
-    onClickInscription: function()
-    {
-        var dataProtocol = "resources/jsp/dataProtocol_fr.jsp";
-        if( !this.isLanguageFr )
-            dataProtocol = "resources/jsp/dataProtocol_en.jsp";
+    } );
 
-        var $dialog = $( '<div></div>' )
-                .load( dataProtocol )
-                .dialog( {
-                             autoOpen: false,
-                             title: loginTexts["login.inscription"],
-                             height: 800,
-                             width: 750
-                         } );
-        $dialog.dialog( 'open' );
 
-        // TODO : see with $dialog.ready() to manage buttons
-    },
-
-    updateLoginOrLogout: function()
-    {
-        <%--if( "<%=UserRole.ADMINISTRATOR%>" == getJSONUserRole() )--%>
-            <%--$( "#button_bo" ).show();--%>
-        <%--else--%>
-            <%--$( "#button_bo" ).hide();--%>
-    }
-
-} );
-
-/** ******************************* **/
-/** *********** ACCOUNT *********** **/
-/** ******************************* **/
-function onClickAcceptDataProtocol()
-{
-    if( '' == $( "#lastName" ).val() || '' == $( "#email" ).val() || '' == $( "#password" ).val() )
-    {
-        showErrorAccount( null, templateTexts["login.dataProtocolFields"] );
-        return;
-    }
-
-    if( $( "#checkboxUser" ).attr( 'checked' ) )
-        createAccount();
-    else
-        showErrorAccount( null, templateTexts["login.dataProtocolAccept"] );
-}
-
-function createAccount()
-{
-    var parametersUrl = "name=" + $( "#lastName" ).val() + "&firstName=" + $( "#firstName" ).val() + "&email=" + $( "#email" ).val() + "&pwd=" + $( "#password" ).val();
-    var request = $.ajax( {
-        url: "project?methodName=createAccount&" + parametersUrl,
-        success:handleCreateAccount,
-        error: showErrorAccount
-    } );
-}
-
-function handleCreateAccount()
-{
-    $( "#infosAccount" ).hide();
-    $( "#infosAccount" ).removeClass( "containerErrors" );
-    $( "#infosAccount" ).addClass( "containerInfos" );
-    $( "#infosAccount" ).html( templateTexts["login.dataProtocol.account"] );
-    $( "#infosAccount" ).show();
-}
-
-function showErrorAccount( result, text )
-{
-    $( "#infosAccount" ).hide();
-    $( "#infosAccount" ).removeClass( "containerInfos" );
-    $( "#infosAccount" ).addClass( "containerErrors" );
-    if( null != result )
-        $( "#infosAccount" ).html( templateTexts[result.responseText] );
-    else
-        $( "#infosAccount" ).html( text );
-
-    $( "#infosAccount" ).show();
-}
 </script>
